[SOLVED] Simple but confusing!
Posted: Mon Jun 14, 2004 1:44 pm
I am creating an admin panel for my site and I have came across some silly error that I just cannot seem to pass. What it is, is that I want only users with a level of 1 or 2 to access the panel otherwise the user is informed with an error message. The code that I cannot seem to pass go's like:
I was thinking perhaps an array with the numbers 1 and 2 but I am not too sure on how I would go about doing that. Any help appreciated!
Code: Select all
$sql = "SELECT * FROM members WHERE username = '".$_SESSION['username']."'";
$result = mysql_query($sql) or die("Error!");
if (mysql_num_rows($result))
{
$row = mysql_fetch_assoc($result);
$level1 = $row['level'];
}
if ($level != '1' || $level != '2')
{
echo "You are not allowed to access this area of the site!<p>";
echo "Click <A href='http://www.site.com/index.php'>here</A> to go to the index page!";
exit;
}
?>