Hi guys,
I made a login, and I have a function that is not working. I'll give you all of the parts to it.
Function:
}
function user_exists($username) {
$username = sanitize($username);
$query = mysql_query("SELECT COUNT (`id`) FROM `members` WHERE `username` = '$username'")
return (mysql_result($query, 0) == 1) ? true : false;
}
login page:
if(empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
if(empty($username) === true || empty($password) === true) {
$errors[] = 'Please enter a username and password.';
}
else if(user_exists($username) === false) {
$errors[] = 'We can\'t find that username. Have you <a href="register.php">register</a>ed?';
}
else if(user_active($username) === false) {
$errors[] = 'You have not activated your account. Check your Email!';
} else {
$login = login($username, $password);
if($login === false) {
$errors[] = 'That username/password combination is incorrect.';
} else {
echo 'You are now logged in. Please wait for the page to refresh or click <a href="home.php">here</a>.';
$_SESSION['id'] = $login;
echo '<meta http-equiv="refresh" content="0;url=home.php">';
exit();
}
}
print_r($errors);
}
?>
Error: Fatal error: Call user_exists() in /home/a1922355/public_html/login.php on line 13