Validate Email And Password Problem

The previous problem resloved very easy but here one more again.
I don’t know what to do.
I try [php]function password_check($email,$password)[/php]
And [php]function password_check($email, $password)[/php]
Still not work.
Need you Help.
i have 2 files:
login.php

[php]if(email_check($email)==TRUE)
{
if(password_check($email,$password)==true)
{
echo “set session”;
}
else
{
die(“Error = 14”);
}[/php]

and function.php

[php]function password_check($email,$password)
{
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$res2 = mysql_query(“select * from users where email=‘email’”);
$row2 = mysql_fetch_array($res2);
if($row2[‘password’] == $password)
{
return true;
}
else
{
return false;
}
}[/php]

I made a few changes to your function.

[php]

<?php function password_check($email,$password) { $email = mysql_real_escape_string($email); $password = mysql_real_escape_string($password); //fetch an user where email and password match $res2 = mysql_query("select * from users where email='$email' AND password='$password'"); if (mysql_num_rows($res2) == 1) { return true; } else { return false; } } ?>

[/php]

let me know if it works.

I am hoping that you have hashed those passwords stored in your database, and are checking the hashed values. If not here is a page to set up your password values as hashes so that it is not a security issue.

http://php.net/manual/en/faq.passwords.php

WOW
Thanks a lot again!

Sponsor our Newsletter | Privacy Policy | Terms of Service