header() question
Posted: Tue Feb 13, 2007 11:09 pm
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:
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?
My problem is if the user tries to see mysite.com/something/page.php
and finds this script:
Code: Select all
if (!isset($_SESSION['userName']) && !isset($_SESSION['userId']))
{
header('Location: http://www.mysite.com/login.php');
exit();
}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?