diff --git a/remote.php b/remote.php index 92a9372..48bd3b5 100644 --- a/remote.php +++ b/remote.php @@ -390,17 +390,13 @@ function handle_award_additional_materials(&$u, &$fair, &$data, &$response) $response['query'] = $data; // echo "Authenticating... "; - $username = mysql_escape_string($username); - $q=mysql_query("SELECT uid FROM users WHERE username='$username'"); - if(mysql_num_rows($q) != 1) { + $u = user_load_by_email($username); + if($u == false) { $response['error'] = 1; - $response['message'] = "Authentication Failed"; + $response['message'] = "Authentication Failed for $username"; echo json_encode($response); exit; } - $i = mysql_fetch_assoc($q); - $u = user_load_by_uid($i['uid']); - $response['i'] = $i; if(!is_array($u) || $u['password'] == '') { $response['error'] = 1; $response['message'] = "Authentication Failed2";