jeswin12 Posted March 6, 2007 Share Posted March 6, 2007 Hi, I need a tutorial or help to display the username after login. I use php and mysql. Thanks Link to comment https://forums.phpfreaks.com/topic/41455-how-to-display-username-after-login/ Share on other sites More sharing options...
simcoweb Posted March 6, 2007 Share Posted March 6, 2007 You can use a SESSION variable or pass it in the url. Then just echo it: > if passed in the URL $username = $_GET['username']; echo "Welcome back" .$username ; It's not real secure to do it that way, though, since the username is now part of the display of the url in the address bar. I'm sure someone has a better more secure way. Link to comment https://forums.phpfreaks.com/topic/41455-how-to-display-username-after-login/#findComment-200837 Share on other sites More sharing options...
boo_lolly Posted March 6, 2007 Share Posted March 6, 2007 or alternatively, you could just GOOGLE IT!!!!!! Link to comment https://forums.phpfreaks.com/topic/41455-how-to-display-username-after-login/#findComment-200838 Share on other sites More sharing options...
Snooble Posted March 6, 2007 Share Posted March 6, 2007 array your database SELECT * FROM tablename where fieldname = value and echo from the array produced from the sql above. Many topics cover this. I suggest to search. Snooble Link to comment https://forums.phpfreaks.com/topic/41455-how-to-display-username-after-login/#findComment-200886 Share on other sites More sharing options...
Jay2391 Posted March 6, 2007 Share Posted March 6, 2007 my way of doing it !!! ////when he originaly log in i set two sessions one with the user name and one with he's name <?php session_start(); $fname = $_SESSION['fname']; $uname = $_SESSION['user_name']; $online = FALSE; if($_SESSION['session_var'] == "skipLogin"){ echo "$fname is online<br>"; echo "User Name:$uname is online<br>"; echo "<a href=\"user_profile.php\"> Check your user Profile !!!</a><br>"; $online = TRUE; }else{ echo "Status: Offline<br>"; echo "YOU NEED TO LOG-IN FOR REGISTRATION !<br> "; echo "<br><a href=\"login.php\">Log-In </a> or <a href=\"ngl_registration.php\">Register </a>"; $online =FALSE; } ?> Link to comment https://forums.phpfreaks.com/topic/41455-how-to-display-username-after-login/#findComment-200887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.