CJLeah Posted April 18, 2006 Share Posted April 18, 2006 I'm having trouble wit a code, i'm quite sure is wrong, what I want is a code that will show the current user, eg Hello Chris. ANyway whats wrong with mine, or whats right, lol. please help :)<?php mysql_query("SELECT username FROM users"); echo ($_POST['username']); ?> Quote Link to comment Share on other sites More sharing options...
Darkness Soul Posted April 18, 2006 Share Posted April 18, 2006 When your user log on the system, are you saving the ID in a session?If you are saving, just put the test on select to select the correct user.=)Are you saving something or just login ?D.Soul Quote Link to comment Share on other sites More sharing options...
CJLeah Posted April 18, 2006 Author Share Posted April 18, 2006 the session is saved, but it's not straight after login, even though your logged in to see it, its more of like, a paragraph of text then sayng they user name.....but I have no idea to get the users name to appear...:(eg:Yo .currentuser. how are you today, please submit the scriptcheck before proceeding.. Quote Link to comment Share on other sites More sharing options...
Yuzi Posted April 18, 2006 Share Posted April 18, 2006 [!--quoteo(post=366152:date=Apr 18 2006, 09:05 PM:name=Chris Leah)--][div class=\'quotetop\']QUOTE(Chris Leah @ Apr 18 2006, 09:05 PM) [snapback]366152[/snapback][/div][div class=\'quotemain\'][!--quotec--]the session is saved, but it's not straight after login, even though your logged in to see it, its more of like, a paragraph of text then sayng they user name.....but I have no idea to get the users name to appear...:(eg:Yo .currentuser. how are you today, please submit the scriptcheck before proceeding..[/quote]I was also trying to display the username, i'm using this once, they're logged in, just rip the username strate out of the session variable...<?php if ($_SESSION['MM_Username'] != NULL) {?>Welcome,<?php echo " ".$_SESSION['MM_Username']; ?>basically, the username is stored in a session variable, so you test to see if they're logged in (as when they're not logged in, the session variable is NULL. If they are logged in, then you display "Welcome <user>".There is a bit more to the code, which if the user is not logged in, it display's a login form. But hopefully that bit will get it working for you! 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.