Q:

sql / php - login check

I have a file that I include on all my webpages that contains the $db_login_status.
It is set at 0 in that file and when you type in the correct information on my login page, it sets 
$db_login_status = 1;

or,
$db_login_status = 2;

depending on the level of user.
I am trying to redirect someone back to the login page if they are not logged in, but this code just makes my page not load. Does not redirect me at all.
Am I going wrong somewhere in here? 
Thanks.
<?php

// ----------------------
// Check for logged in

if ($db_login_status = 0;) {
     header("location: index.php");
     exit();
}

?>

A:

Remove ; in your if-statement and add one more =
<?php

// ----------------------
// Check for logged in

if ($db_login_status == 0) {
     header("location: index.php");
     exit();
}

?>

