PHPDevil Posted December 19, 2012 Share Posted December 19, 2012 (edited) I didn't think this was suppose to be difficult but i've made a mess of something which I think is straight forward O,o Issue is on my login page, if the username and password is right, that user doesn't get redirected. O,o if ($hash == $dbpass) { $error_string .= 'Authentication succeeded'; $_SESSION['login'] = "1"; $_SESSION['username'] = $username; $_SESSION['email'] = $email; $_SESSION['ID'] = $id; header('Location: loggedin.php'); } I do have session_start(); at the top of my login page. The loggedin page has just this <?php session_start(); require "corefolder/globe.php"; if(empty($_SESSION['login']) || empty($_SESSION['username']) || empty($_SESSION['email']) || empty($_SESSION['ID'])) { header('location: login.php'); die(); } ?> globe.php is just my database connection. thats fine Should mention that i did comment out the if statement in loggedin for debugging but still no luck Edited December 19, 2012 by PHPDevil forgot something Quote Link to comment Share on other sites More sharing options...
sniko Posted December 20, 2012 Share Posted December 20, 2012 put the header() statement before any HTML. The header() statement is what 'redirects', not the session. I hope this helps you, sniko Quote Link to comment Share on other sites More sharing options...
PHPDevil Posted December 23, 2012 Author Share Posted December 23, 2012 Thanks for your help sniko (i like that name...reminds me of snickers! :P) Yeah I should have read the manual, it was because i had "requre header.php" at the top so i just moved that down. Thanks for your time! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.