Fix fair login for remote commands

This commit is contained in:
james 2009-11-06 02:24:04 +00:00
parent e58ce49aed
commit cb7033f7ae

View File

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