Help with VERY simple login page.

Its supposed to bring me to a new page, but alas, this isn’t so. Please, any recommendations?

[code]$usertrying = $_POST[username];
$ptrying = $_POST[password];
$secured_password = sha1($ptrying);

$user_correct = false;
$pw_correct = false;

$query = “SELECT * FROM USERS WHERE USERNAME=’$usertrying’ AND PASSWORD =’$secured_password’”;
$result = mysql_query($query)

if (mysql_num_rows($result) > 0) {

$user_correct = true;
$pw_correct = true;

}

if(($user_correct) && ($pw_correct))
{
$username = $usertrying;
session_register(‘username’);
header(‘Location:http://*******.com/privatedata.php’);
}

else
{
header(‘Location:http://******.com/login.php’);
}
[/code]

Btw, the DB connection is all good. Thanks.

Any error messages?

What’s it doing or not doing?

Its just staying on the page and not redirecting. And no I don’t have any HTML headers before it. I know that they make the redirect code disfunct if put in before it.

Sponsor our Newsletter | Privacy Policy | Terms of Service