Jump to content

Show Currentuser


CJLeah

Recommended Posts

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']); ?>
Link to comment
Share on other sites

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..
Link to comment
Share on other sites

[!--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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.