psychohagis Posted January 3, 2007 Share Posted January 3, 2007 I have a log-in script, and once everything has been verified it iniated the session as follows,[code=php:0]session_start();$_SESSION['userid'] = $userid;$_SESSION['username'] = $_POST['username'];[/code]Then i have script which checks for a session which is as follows[code=php:0]if (!isset($_SESSION['userid']) or $_SESSION['userid'] ==''){echo '<a href=/members/signup.php>sign up</a> | <a href=/members/signin.php>sign in</a>';} else {$username=$_SESSION['username'];echo 'signed in as <a href=/members/>' . $username . '</a> | <a href=/members/signout.php>sign out</a>}[/code]However, this asks me to log-in, even when I have.Have I started the session incorectly, what could be causing this? Link to comment https://forums.phpfreaks.com/topic/32698-session-issues/ Share on other sites More sharing options...
trq Posted January 3, 2007 Share Posted January 3, 2007 You need to call session_start() in every script that uses sessions. Link to comment https://forums.phpfreaks.com/topic/32698-session-issues/#findComment-152158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.