Jump to content

Welcome "username"


Heba

Recommended Posts

If you are using sessions, when you first create it in login_process.php or whatever then put
[code]  $session_username=$_POST["username"];
    session_register("session_username");   [/code]

then you can display

[code]<? echo $session_username ?>  [/code]
anywhere on the page, if someone is logged in then it will display theirname you can expand on that by doing this
[code]<?
if(!$session_username) //if there is no session username do the following
{
echo "You are not logged in, please either <a href=login.php>login</a> or <a href=register.php>register</a>, its free!";
}
else //if there is a session username do the following
{
echo "Welcome Back $session_username";
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/3806-welcome-username/#findComment-13223
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.