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 Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/ 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. Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/#findComment-1115151 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 Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/#findComment-1115152 Share on other sites More sharing options...
PFMaBiSmAd Posted September 24, 2010 Share Posted September 24, 2010 That would be !isset() Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/#findComment-1115154 Share on other sites More sharing options...
snallemap Posted September 24, 2010 Author Share Posted September 24, 2010 Ah thank you Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/#findComment-1115158 Share on other sites More sharing options...
snallemap Posted September 24, 2010 Author Share Posted September 24, 2010 Works perfectly Thanks ! Link to comment https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/#findComment-1115159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.