tqla Posted June 12, 2007 Share Posted June 12, 2007 I want to show a Logout link only if a user is actually logged in. Is there a way to show a bit of PHP code ONLY if a user session exists? If so, what's the code? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/55191-solved-show-logout-only-if-logged-in/ Share on other sites More sharing options...
smc Posted June 12, 2007 Share Posted June 12, 2007 <?php session_start(); // Set the var $_SESSION['enabled'] at login if( isset( $_SESSION['enabled'] ) ){ echo( "Logout" ); }else{ echo( "Login" ); } ?> Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/55191-solved-show-logout-only-if-logged-in/#findComment-272836 Share on other sites More sharing options...
Caesar Posted June 12, 2007 Share Posted June 12, 2007 Edit: Answered above. Quote Link to comment https://forums.phpfreaks.com/topic/55191-solved-show-logout-only-if-logged-in/#findComment-272838 Share on other sites More sharing options...
tqla Posted June 12, 2007 Author Share Posted June 12, 2007 Thank you smc. ( man I dig this forum ) Quote Link to comment https://forums.phpfreaks.com/topic/55191-solved-show-logout-only-if-logged-in/#findComment-272895 Share on other sites More sharing options...
smc Posted June 12, 2007 Share Posted June 12, 2007 Glad I could help Quote Link to comment https://forums.phpfreaks.com/topic/55191-solved-show-logout-only-if-logged-in/#findComment-272897 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.