Jump to content

header issue


speedy33417

Recommended Posts

I'm getting stuck with a header issue. I have a login page at mysite.com/login.php and I'd like to direct any unathorized access to this page from any part of the site.

My problem is if the user tries to see mysite.com/something/page.php

and finds this script:

 

if (!isset($_SESSION['userName']) && !isset($_SESSION['userId'])) 
{ 
        header('Location: http://www.mysite.com/login.php'); 
        exit(); 
} 

 

Once the user's redirected I expected it to jump directly to mysite.com/login.php, however somehow it only includes the script from login.php but stays in the something folder.

I don't have absolut urls in the login.php script meaning that any images used on that page are broken and won't load, because they have the wrong path.

 

Is there a quick fix to this problem?

 

Do I need to change everything to absolut urls or can I do something to phisically jump to mysite.com/login.php?

Link to comment
https://forums.phpfreaks.com/topic/38432-header-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.