I've been messing arround with this for the past little while and I can't seem to figure out the best way to to about doing this. Essentially, I'm trying to create a three part statement. The first will check is a session variable isset & the user has a rolecd of 2. If not, it will check to see if the session variable isset. If not, then it displays a login message. Any help would be much appreciated and I'm sorry, I just getting use to the isset construct and I'm not as familiar with it. From what I understand; however, session_is_registered is being deprecated in PHP5, so it would be best to use isset.

if (isset($_SESSION['UserID']) and ($_SESSION['RoleCD'] == 2)) {echo "Welcome Back Admin";} 
elseif {echo "Welcome Back <a href=\"profile.php\">".$_SESSION['FName']."</a> | <a href=\"logout.php\">Logout</a>";} 
else {echo "Not Logged In"." | <a href=\"login.php\">Login</a>";}

Edited by jrotunda85: n/a

6 Years
Discussion Span
Last Post by jrotunda85

Wouldn't you know, as soon as I post this, I figured out how to do this with a nested IF Statement as opposed to using ELSEIF. :zzz:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.