I believe there's a few things wrong here:
- You're reading the cookie before checking if it's set. That's a mistake. You should see if there's a cookie, and THEN read it in. You also don't need to assign it a separate variable.
Note: As I said in my comment, user data should be in a session, not a cookie.
- I don't know what your DB schema looks like, but your query is
SELECT * FROM user
, meaning that if you have an ID, a user name, an access level, and some other things, you're going to get ALL that into the var$acctype
, which obviously isn't an integer.
I think the fix is to execute your query, get your results, and then compare the row(s) returned and only check the acctype
part:
if ($row['acctype'] >= 1){
}
Documentation: http://us1.php.net/mysqli_fetch_assoc