I'm writing a simple login script for my script, and am having a wee problem: When they log in, a cookie is set with their admin level. I got the login working properly for the program, I got the cookie to write to the computer. I even figured out how to get the variables from the cookie. But the following part isn't working!! Can you take a sec to look it over and see if there's anything glaringly wrong? (This is only part of the code, but it's the relevant part, I believe)
//I get the cookie information, and I echoed it to see that I actually got something. In this specific case, the level equals 3, and it is displaying as such.
global $HTTP_COOKIE_VARS;
$level = $HTTP_COOKIE_VARS["cookie_level"];
echo "$level";
//The following should only display certain links to people if they are a certain level. In this specific case, I'm only logged in as level 3, so I should only see the last set of links. But I'm seeing them all! 🙁 Any suggestions?
if ($level == ('1' || '2'))
{
echo "<a href=\"admin.php?action=categories\">Categories</a>
| <a href=\"admin.php?action=characters\">Characters</a>
| <a href=\"admin.php?action=ratings\">Ratings</a>
| <a href=\"admin.php?action=genres\">Genres</a>
| <a href=\"admin.php?action=warnings\">Warnings</a>
| <a href=\"admin.php?action=authors\">Authors</a>";
}
if ($level == '1')
{
echo "
| <a href=\"admin.php?action=settings\">Settings</a>
| <a href=\"admin.php?action=admins\">Admins</a>";
}
if ($level == ('1' || '2' || '3'))
{
echo "
<br><br>
<a href=\"admin.php?action=submitted\">View Submitted</a>
| <a href=\"admin.php?action=addstory\">Add Story</a>";
}
What stumps me is that the echoing of the $level variable up above is clearly showing the value of 3, so why this isn't working, I dunno.