Page 1 of 1

How to verify pages for different sites

Posted: Mon Feb 17, 2014 1:04 am
by weixin268
Have environment as shown on below:

phpMain at headquarter for login control & mysql database
phpA at branch office A, has phpA web for sharing d:\dataA\sharing
phpB at branch office B, has phpB web for sharing d:\dataB\sharing

user(s) will login to phpMain/index.php, after login can access phpA/fileshare.php & phpB/fileshare.php, but the problems is phpA/fileshare.php or phpB/fileshare.php no need to login, as they are not under phpmain/, they are located a phpA & phpB.

added below code into phpA/fileshare.php & phpB/fileshare.php, but always stop at the phpMain/index.php

Code: Select all

session_start();
if (!isset($_SESSION['username']) || $_SESSION['username'] == '') {
    header ("Location: http://www.phpmain.com/index.php");
    exit();
}

Re: How to verify pages for different sites

Posted: Mon Feb 17, 2014 1:37 am
by requinix
Make sure your session cookie settings specify a path below phpMain, phpA, and phpB. Such as /.