Hello everyone,
I'm having this code to check if a user is exists in my database and check his password, everything goes well until i enter the real password of a user, in register form, i fill the password as "hello" , but i can't login with that password, i've tried to modify the password field in MySQL, but it still. I think this happen because my PHP code, the IF statement must be wrong somewhere, i'll be greatly appreciate your help
<?php
require_once("MySQL.php");
if ( $_GET['act'] == "do" )
{
$username = addslashes( $_POST['UserName'] );
$password = md5( addslashes( $_POST['Password'] ) );
$sql_query = mysql_query("SELECT id, username, password FROM members WHERE username='$username'");
$member = mysql_fetch_array( $sql_query );
if ( mysql_num_rows( $sql_query ) <= 0 )
{
echo "<p id=NormalText>This Username isn't exist !";
exit;
}
if ( $password != $member['Password'] )
{
echo "<p id=NormalText>Incorrect Password !";
exit;
}
//session_start();
//$_SESSION['user_id'] = $member['id'];
echo "<p id=NormalText>Thanks, you're now log in !";
}
?>