speedy33417 Posted February 14, 2007 Share Posted February 14, 2007 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 More sharing options...
redarrow Posted February 14, 2007 Share Posted February 14, 2007 you got html before the header so in this case a solution not a proper programmers method use the top page ob_start(); bottom page ob_end_flush(); Link to comment https://forums.phpfreaks.com/topic/38432-header-issue/#findComment-184367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.