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! 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 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. 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 ) 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 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
Archived
This topic is now archived and is closed to further replies.