Page 1 of 1

Display user name

Posted: Sun Jan 01, 2006 12:12 pm
by spamyboy
Hi all,
could anyone give me e.g. hot to display registered username (if he loged in)
using: seesion and mysql db

Posted: Sun Jan 01, 2006 1:44 pm
by mickd
something like this was posted not long ago

viewtopic.php?t=42367

Posted: Sun Jan 01, 2006 11:40 pm
by s.dot
you'll want to store the username he/she logged in with into a session variable

IE:

Code: Select all

$_SESSION['username'] = mysql_real_escape_string($_POST['username']);
then to display it:

Code: Select all

echo $_SESSION['username'];

Posted: Mon Jan 02, 2006 12:33 am
by mickd
on second thought, i think he might be after displaying all users online (like a whos online). like at the bottom of this forum. not just displaying a welcome message to them. maybe...

if not, then above messages will work fine.

Posted: Mon Jan 02, 2006 7:40 am
by spamyboy
Yes exatly, I awnt to display 'who is online'. I know how wo diplay, wellcome msg (im seting new sesion if login secseful). But how to display users online?

Posted: Mon Jan 02, 2006 2:29 pm
by mickd
i did a search and got this thread, might help

viewtopic.php?t=42381&highlight=online