Jump to content

How to display username after login?


jeswin12

Recommended Posts

You can use a SESSION variable or pass it in the url. Then just echo it:

 

 

> if passed in the URL

$username = $_GET['username'];

echo "Welcome back" .$username ;

 

It's not real secure to do it that way, though, since the username is now part of the display of the url in the address bar. I'm sure someone has a better more secure way.

 

 

Link to comment
Share on other sites

my way of doing it !!!

 


////when he originaly log in i set two sessions one with the user name and one with he's name 
<?php 
session_start();
$fname = $_SESSION['fname'];
$uname = $_SESSION['user_name'];
$online = FALSE; 

   if($_SESSION['session_var'] == "skipLogin"){
         echo "$fname is online<br>";
	  echo "User Name:$uname is online<br>";
	  echo "<a href=\"user_profile.php\"> Check your user Profile !!!</a><br>";
	  $online = TRUE; 
	   
   }else{
         echo "Status: Offline<br>";
	  echo "YOU NEED TO LOG-IN FOR REGISTRATION !<br> ";
	  echo "<br><a href=\"login.php\">Log-In </a> or <a href=\"ngl_registration.php\">Register </a>";
	  $online =FALSE;
   }
?>


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.