rajeshkuchana Posted January 28, 2014 Share Posted January 28, 2014 Dear All, I am new to php i have created login/Sign up pages and problem is i needd code to display logout after users login into system but in my system both login/Register is dislaying after login also Please help me in this one.. Link to comment https://forums.phpfreaks.com/topic/285739-how-to-display-login-and-logout-using-condition-in-headerphp-file/ Share on other sites More sharing options...
adam_bray Posted January 28, 2014 Share Posted January 28, 2014 Use a simple if & else statement depending on the cookie/session being set, then echo/print the relevant links. Link to comment https://forums.phpfreaks.com/topic/285739-how-to-display-login-and-logout-using-condition-in-headerphp-file/#findComment-1466835 Share on other sites More sharing options...
lhemingway Posted January 28, 2014 Share Posted January 28, 2014 <?php if(!isset($_SESSION['user'])) { echo '<li><a href="login.php">Login</a></li>'; } else { echo '<li><a href="logout.php">Log out</a></li>'; } ?> Link to comment https://forums.phpfreaks.com/topic/285739-how-to-display-login-and-logout-using-condition-in-headerphp-file/#findComment-1466836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.