Logged in as

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Stephan1992
Posts: 25
Joined: Tue Oct 12, 2010 3:16 pm

Logged in as

Post 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?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Logged in as

Post 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']; ?>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Stephan1992
Posts: 25
Joined: Tue Oct 12, 2010 3:16 pm

Re: Logged in as

Post by Stephan1992 »

arrigato gozaimasu.

cheers!

My company will donate to you, in 2 weeks or so.
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Re: Logged in as

Post 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 :)
Post Reply