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.

 

 

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;
   }
?>


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.