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']; ?> 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? 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 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 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
Archived
This topic is now archived and is closed to further replies.