samoi Posted October 13, 2009 Share Posted October 13, 2009 Hello, I have this code: <?php /** * @author samoi * @copyright 2009 */ error_reporting(E_ALL & E_NOTICE); include ('func.php'); // this has the session_start() func! if (isset($_SESSION["uid"])) { $_SESSION["uid"]+= 1; } else { header('location: login.php'); // it's not redirecting! it gives a white page only! die(); // I run this die() and error_reporting() to debug, but no chance! } echo $_SESSION["uid"]; echo '<br />'; echo '<a href="logout.php"> LogOut </a>'; ?> it works if it's in ongoing session! but fails if no session in there, it does not work "header()" ! Thank you in advance! Link to comment https://forums.phpfreaks.com/topic/177506-solved-help-header-is-not-working/ Share on other sites More sharing options...
trq Posted October 13, 2009 Share Posted October 13, 2009 You have whitespace before your opening <?php tag. Link to comment https://forums.phpfreaks.com/topic/177506-solved-help-header-is-not-working/#findComment-935911 Share on other sites More sharing options...
samoi Posted October 13, 2009 Author Share Posted October 13, 2009 You have whitespace before your opening <?php tag. genius ! I greatly appreciated it ! Link to comment https://forums.phpfreaks.com/topic/177506-solved-help-header-is-not-working/#findComment-935913 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.