chase779 Posted May 18, 2009 Posted May 18, 2009 I'm trying to code my login page so if the user goes to www.mysite.com/login.php and they are already logged in, it will rediect them to index.php Guess I should use something like: if($_SESSION['loggedin']==0) { header("Location: index.php");exit; } How would I reverse that? if($_SESSION['loggedin']==1) { header("Location: index/");exit; } But that doesn't work, any help would be much appreciated. Thanks Quote
Lithium Posted May 18, 2009 Posted May 18, 2009 Re: If logged in redirect help you are making the wrong assumption... The user is already logged, goes to index.php if($_SESSION['loggedin']) { header("Location: index.php"); exit; } User is not logged, goes to login.php else if(!$_SESSION['loggedin']) { header("Location: login.php"); exit; } Quote
chase779 Posted May 18, 2009 Author Posted May 18, 2009 Re: If logged in redirect help Thanks :) Quote
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.