nathanmaxsonadil Posted August 17, 2007 Share Posted August 17, 2007 I have a login script that checks for error's and then if your password and username match the ones in the database it set's session variable's and then redirects you however when I tried it redirected me but when I tried to echo the session variable it was blank here's where I declare my session variable's in login.php else if($row['password'] == sha1($_POST['password']) && $row['username'] == $_POST['username']) { $_SESSION['username'] == $row['username']; $_SESSION['email'] == $row['email']; $_SESSION['loggedin'] == true; $_SESSION['points'] == $row['points']; echo "<script type='text/javascript'> <!-- window.location = 'http://www.swapinvites.com/' //--> </script>"; } and here's where I echo loggedin <?php session_start(); echo $_SESSION['loggedin']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65525-solved-not-setting-session-varibles/ Share on other sites More sharing options...
simon551 Posted August 17, 2007 Share Posted August 17, 2007 do you have session_start(); at the top of your first script? Quote Link to comment https://forums.phpfreaks.com/topic/65525-solved-not-setting-session-varibles/#findComment-327194 Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 $_SESSION['points'] = $row['points']; NOT == apply to all Quote Link to comment https://forums.phpfreaks.com/topic/65525-solved-not-setting-session-varibles/#findComment-327195 Share on other sites More sharing options...
nathanmaxsonadil Posted August 17, 2007 Author Share Posted August 17, 2007 lol I guess I'm to sleepy today Quote Link to comment https://forums.phpfreaks.com/topic/65525-solved-not-setting-session-varibles/#findComment-327199 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.