Display user name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Display user name

Post by spamyboy »

Hi all,
could anyone give me e.g. hot to display registered username (if he loged in)
using: seesion and mysql db
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

something like this was posted not long ago

viewtopic.php?t=42367
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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'];
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post 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.
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post 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?
mickd
Forum Contributor
Posts: 397
Joined: Tue Jun 21, 2005 9:05 am
Location: Australia

Post by mickd »

i did a search and got this thread, might help

viewtopic.php?t=42381&highlight=online
Post Reply