diff options
Diffstat (limited to 'includes/model/User_model.php')
-rw-r--r-- | includes/model/User_model.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/model/User_model.php b/includes/model/User_model.php index 4e833aef..7eb31e8e 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -1,11 +1,12 @@ <?php - /** * Returns user by id. * @param $id UID */ function User($id) { $user_source = sql_select("SELECT * FROM `User` WHERE `UID`=" . sql_escape($id) . " LIMIT 1"); + if($user_source === false) + return false; if(count($user_source) > 0) return $user_source[0]; return null; @@ -31,7 +32,9 @@ function User_by_api_key($api_key) { */ function User_reset_api_key(&$user) { $user['api_key'] = md5($user['Nick'] . time() . rand()); - sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1"); + $result = sql_query("UPDATE `User` SET `api_key`='" . sql_escape($user['api_key']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1"); + if($result === false) + return false; engelsystem_log("API key resetted."); } |