joecooper Posted May 5, 2008 Share Posted May 5, 2008 on a logon page, once the user has put in all their login details, and its been verified etc, i use this code: $_SESSION['loggedin']="TRUE"; then the user clicks a link to another page with this code: <?php include("db.php"); if($_SESSION['loggedin']=="TRUE"){ echo("Welcome $username!<br>"); echo("<hr>"); }else{ die("You are not logged in. Please <a href='login.php'>click here</a> to log in!"); } ?> and it just says they are not logged in Link to comment https://forums.phpfreaks.com/topic/104150-solved-session-varible/ Share on other sites More sharing options...
trq Posted May 5, 2008 Share Posted May 5, 2008 On your second page, your missing a call to session_start(). Link to comment https://forums.phpfreaks.com/topic/104150-solved-session-varible/#findComment-533204 Share on other sites More sharing options...
joecooper Posted May 5, 2008 Author Share Posted May 5, 2008 put it in as the first line after <?php and didnt work still Link to comment https://forums.phpfreaks.com/topic/104150-solved-session-varible/#findComment-533207 Share on other sites More sharing options...
joecooper Posted May 5, 2008 Author Share Posted May 5, 2008 ah.. missed it out on the first page tho!! and i also put die(); just before i set the varible! Link to comment https://forums.phpfreaks.com/topic/104150-solved-session-varible/#findComment-533210 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.