Page 1 of 1

Logged in as

Posted: Fri Nov 19, 2010 1:40 pm
by Stephan1992
Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
Hey,

I would like to have a function, like "Logged in as: BLABLA1"
Also, I would like to see, when i enter credentials and login, Welcome BLABLA1!
Is this a quickfix?

Re: Logged in as

Posted: Sat Nov 20, 2010 12:13 pm
by Klemen
Name is stored in the $_SESSION['name'] variable so you would have to paste something like this in the place where you want the name to appear:

If within PHP code:

Code: Select all

echo $_SESSION['name'];
If within HTML:

Code: Select all

<?php echo $_SESSION['name']; ?>

Re: Logged in as

Posted: Tue Nov 23, 2010 2:19 pm
by Stephan1992
arrigato gozaimasu.

cheers!

My company will donate to you, in 2 weeks or so.

Re: Logged in as

Posted: Tue Feb 01, 2011 3:17 pm
by Raven
Hi, the following code is what I use for my show_admin_nav.inc.php:

Code: Select all

		<?php
		$hour = date("H");
		if ($hour < 12)
		  {
		  echo "<div align=\"center\">Good morning ";
		  echo  $_SESSION['name'];
		  echo ".</div>";
		  }
		  elseif ($hour < 17)
		     {
		     echo "<div align=\"center\">Good afternoon ";
			 echo  $_SESSION['name'];
			 echo ".</div>";
		     }
		     else
		         {
		         echo "<div align=\"center\">Good evening ";
				 echo  $_SESSION['name'];
		  		 echo ".</div>";
		         }
		?>
This will show either Good morning $_SESSION['name'], Good afternoon $_SESSION['name'] or Good evening $_SESSION['name'] depending on the time of day ;)

Hope you find it useful :)