Unholy Prayer Posted October 4, 2006 Share Posted October 4, 2006 Ok, I have my sessions code for my user authentication script, but I want to display the user's username once they are logged in. I also want the links in a certain part of the page to change once they are logged in. Here is my coding:[code]//check cookie if ($_SESSION['logged_in'] != 1 && isset($_COOKIE['login_cookie'])) { list($user, $pass) = explode('[]', $_COOKIE['login_cookie']); $qu = mysql_query("SELECT `user_password` FROM `members` WHERE `username` = '".addslashes($user)."'"); if (mysql_num_rows($qu) == 1) { $passw = mysql_fetch_object($qu); if ($passw->user_password == $pass) { $_SESSION['logged_in'] = 1; $_SESSION['username'] = $user; $_SESSION['password'] = $pass; } } }if(!isset($_SESSION['username']) && !isset($_SESSION['password'])) { $_SESSION['logged_in'] = 0; $user = "Guest"; }[/code]How would I do this? Quote Link to comment Share on other sites More sharing options...
Kelset Posted October 4, 2006 Share Posted October 4, 2006 Not really sure for I have not done a whole lot with sessions. Displaying the user name on the page would not be to hardsince you already put it into the session. Just call it up from the session() where you want to use it. As for you link changingproblem I would make set a session to a link type. Once they log in I would check to see what link type they are usingand use PHP to display a menu of links from a include file.Not sure if I made any sense there or not... I guess it would depend on how many different link set ups you have.I hope this helped in some weird way.Cheers!Stephen Quote Link to comment 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.