Trouble with 'if' when someone is logged in
I am trying to setup a conditional that would show either a menu or links depending on if someone is logged in and what their user level is. The following code was working well with the links until I tried to add the admin links.
<?php if ($_SESSION['UserLevel'] >= '1') {
echo "<h3><a href=/visitors_profile.php>Update Account</a></h3>" ;
echo "<h3><a href=/visitors_LogOut.php>Logout</a></h3>" ;
} else{
echo "<h3><a href=/visitors_LogIn.php>Login</a></h3>" ;
}
?>
I was wanting anyone who had a user level of 1 or greater to see the logout and Update links.
I removed the admin links but it still wouldn't work and until I deleted the pages the Security Wizard made (login, logout, etc) and re-created them, the system wouldn't allow anyone to log in. You could enter correct or incorrect data and the login page would come up, not direct you to the failed page.
So, to test things, I added this code
<?php if (!isset($_SESSION['VisitorID'])) { echo "Session['VisitorID'] == NULL" ; } ?>
On pages that deal with the shopping cart, the line doesn't show up, on pages that are information about the business, it does show up, even though the person is logged in. However, on all pages, the login link is shown even if someone is already logged in.
The Session variable is available in all the pages within Dreamweaver.
if you would like to see, website is www.cis-portraits.com Print Store is the shopping cart, other pages is information.
You can log in with
username: test@test.com
password: blah
Only allows someone to order and view their proofs if they have any. No admin functions under that login.