Check the sign in username and display some text.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mike1234
Forum Newbie
Posts: 4
Joined: Thu Jul 10, 2014 5:59 am

Check the sign in username and display some text.

Post by mike1234 »

I require some simple PHP help... Any help will be much appreciated!
There are only two types of sign ins:

Username: management and Password: xxx
and
Username: employee Password: xxx

I would like to display some text on my webpage that says ‘Management Sign in Area” Only if management signs in and not display it if an employee signs in. Security is not an issue here just the ability to achieve the task.

I have to check the username they logged in with; examine the value of the
$_SERVER['REMOTE_USER'] variable.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Check the sign in username and display some text.

Post by Celauran »

What are you stuck on? This sounds like you just want to wrap some text/markup in a conditional.

Code: Select all

<?php if ($user == 'management'): ?>
    <div>Management area</div>
<?php endif; ?>
mike1234
Forum Newbie
Posts: 4
Joined: Thu Jul 10, 2014 5:59 am

Re: Check the sign in username and display some text.

Post by mike1234 »

Yup that sounds right but its not working for some reason.

DO I have to I have to check the username they logged in with; examine the value of the
$_SERVER['REMOTE_USER'] variable?
mike1234
Forum Newbie
Posts: 4
Joined: Thu Jul 10, 2014 5:59 am

Re: Check the sign in username and display some text.

Post by mike1234 »

I have got it!

Wohooo feels good when you get it. Thanks Celauran for you help you are a Star!

This was it.

<?php if ($_SERVER['REMOTE_USER'] == 'management'): ?>
<div><p><a href="xxx">Click Here for Management Area</a></p></div>
<?php endif; ?>
Post Reply