0
I have this function:
function login($username, $password) {
$user_id = user_id_from_user_name($username);
$username = sanitize($username);
$password = md5($password);
return (mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE
`username` = '$username' AND `password` = '$password'"), 0) == 1) ? $user_id : false;
}
Which is what returns the correct result (true
if username and pass match)
but this down, that I don’t see dif no difference no longer works. Someone knows what I’m doing wrong?
function login($username, $password) {
$user_id = user_id_from_user_name($username);
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username' AND `password` = '$password'");
$username = sanitize($username);
$password = md5($password);
return (mysql_result($query, 0) == 1) ? $user_id : false;
}
That’s what it was all about
– Miguel
If possible, mark the answer as accepted :)
– Paulo Coghi