How to verify pages for different sites

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
weixin268
Forum Newbie
Posts: 15
Joined: Mon Feb 17, 2014 12:53 am

How to verify pages for different sites

Post 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();
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to verify pages for different sites

Post by requinix »

Make sure your session cookie settings specify a path below phpMain, phpA, and phpB. Such as /.
Post Reply