0

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

3
Contributors
2
Replies
19
Views
4 Years
Discussion Span
Last Post by phorce
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.