AdRock Posted August 9, 2006 Share Posted August 9, 2006 I am very new to using sessions so i don't know if it's possible and how to do it.1st question.When a user logins to the site, how do i display their name much like in here where you see hello username?I have a session called $_SESSION['username']2nd questionI obviously have a link to login. When the user successfully logs in is there a way of changing the link to logout so there is no option for the user to login again?3rd questionHow would i go about having a 'remember me' so the user doesn't have to login next time they visit the site?Many thanks for all your help Link to comment https://forums.phpfreaks.com/topic/17081-i-have-3-questions-about-login-sessions/ Share on other sites More sharing options...
onlyican Posted August 10, 2006 Share Posted August 10, 2006 1)You can echo the sessionecho $_SESSION["username"];2) again using the above var and an if statementif($_SESSION["username"]){echo "logout link";}else{echo "log in link";}3)Use cookiesand set the field data, then on log in page, call the cookie, if its there complete the form with the info in the cookie Link to comment https://forums.phpfreaks.com/topic/17081-i-have-3-questions-about-login-sessions/#findComment-72128 Share on other sites More sharing options...
wildteen88 Posted August 10, 2006 Share Posted August 10, 2006 [quote]2) again using the above var and an if statementif($_SESSION["username"]){echo "logout link";}else{echo "log in link";}[/quote]I'd use if isset like so:[code=php:0]if(isset($_SESSION["username"])) { echo "logout link";} else { echo "log in link";}[/code] Link to comment https://forums.phpfreaks.com/topic/17081-i-have-3-questions-about-login-sessions/#findComment-72399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.