I have a simple login script that I want to test if the password is in temp status or not, if it is, then I want it to take them to changepass.php instead of index.php as seen below...

but it doesnt take you to changepass.php it take you right to index.php.

I thought I had this correct but I guess I am wrong...

also, I know I am using the old mysql not MYSQLI, I will change it over when later on..

        $sql="SELECT id FROM admin WHERE username='$myusername' and passcode='$shapass' and access_level ='2'";
    $temppass = $row['temppass'];

    if($temppass == 0){
            header("location: index.php");
                header("location: changepass.php");
            $errmsg = "Access Denied, Please try this <a href='../login.php'>login instead</a>.";



Echo $sql then run it manually in mysql and see if it returns the desired result. My guess is it isn't

Don't use mysql_* or session_register