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'";
        $result=mysql_query($sql);
        $row=mysql_fetch_array($result);
        $count=mysql_num_rows($result);
    $temppass = $row['temppass'];

    if($temppass == 0){
            if($count==1){
            session_register("username");
            $_SESSION['login_user']=$myusername;
            header("location: index.php");
            }else{
                header("location: changepass.php");
            }
        }else{
            $errmsg = "Access Denied, Please try this <a href='../login.php'>login instead</a>.";
                    }
                }
            }
    }

Thanks,

Patrick

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.