Well I give up! I have done my best but I can not figure out why this query does not work.
I am trying to have a query check (after a user logs into the system) for the user's secuirty level. The way i would like it to work is if the cookie is set check the database for the security level of the username defined in the cookie.
Here's the code that does not work.
<?php
ob_start();
if (!isset($_COOKIE['login'])){
header('location: login.php');
}
include('mysql_connect_login.php');
$sql = "select level from users where username = '" . $_COOKIE['login'] . "'";
if ($sql['level'] >= "2") {
header('location: ../tech_supp.php');
} else {
print "<script>alert('You do not have enough access');</script>";
mysql_close();
}
?>
What is happening is well, nothing either the query does not return what i need or it seems to ignore my if statement.