snallemap Posted September 24, 2010 Share Posted September 24, 2010 Alright, so meanwhile i wait for answer on the other thread i started another project, to fix the menu... but it was a bit confusing so now i ask you again!... Heres my current menu.php <?php include "config.php"; if (!$_SESSION["valid_user"]) { echo '<a href="login.php">' . 'Login <br/><br/>' . '</a>'; } if ($_SESSION["valid_user"]) { echo '<a href="logout.php">' . 'Logout <br/><br/>' . '</a>'; echo '<a href="members.php">' . 'Control Panel <br/><br/>' . '</a>'; } echo '<a href="memberlist.php">' . 'Members <br/><br/>' . '</a>'; echo '<a href="ranking.php">' . 'Rankings <br/><br/>' . '</a>'; ?> Now it works perfectly when logged in, but when you logout the session dies, leaving me with this: Notice: Undefined index: valid_user in C:\wamp\www\kawaii\menu.php on line 5 Login Notice: Undefined index: valid_user in C:\wamp\www\kawaii\menu.php on line 10 Members Rankings Now, how can i make a login that depends on if your logged in if this happens when you logout..., i hope someone can find a solution that can work out Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 24, 2010 Share Posted September 24, 2010 Use isset to test the $_SESSION variable. It won't produce an error when the variable does not exist. Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 24, 2010 Author Share Posted September 24, 2010 isset() cannot be used to check if your logged out can it?..., if it can then i dunno how to set it up in the code Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 24, 2010 Share Posted September 24, 2010 That would be !isset() Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 24, 2010 Author Share Posted September 24, 2010 Ah thank you Quote Link to comment Share on other sites More sharing options...
snallemap Posted September 24, 2010 Author Share Posted September 24, 2010 Works perfectly Thanks ! Quote Link to comment 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.