From ca1532364c34d89c7b25ffae6737f84b63caf63a Mon Sep 17 00:00:00 2001 From: Arctic Code Date: Fri, 26 Jul 2013 23:34:49 -0500 Subject: [PATCH] Fix queries in reset API key All of this playing with sql is starting to give me a headache Beginning test of reset api key --- api.backend.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api.backend.php b/api.backend.php index 0bf45f9..7b947f3 100644 --- a/api.backend.php +++ b/api.backend.php @@ -344,7 +344,7 @@ class api{ // I don't really like this code - Basically I need to check if a generated key is totally unique and generate a new one if it isn't $sql = "SELECT * FROM `users`"; - if(!$result = $apidb->query($apisql)) return 'ERROR: ['.$apidb->error.']'; + if(!$result = $apidb->query($sql)) return 'ERROR: ['.$apidb->error.']'; $theapikey = ''; while($row = $result->fetch_assoc()){ $theapikey .= $row['key'].'-'; @@ -356,8 +356,8 @@ class api{ } // End API key check - FIX THIS SHIT - $sql = "UPDATE `users` SET `apikey` = '$key' WHERE `resetkey` = '$resetkey' AND `name` = '$appname';"; - if(!$result = $apidb->query($apisql)) return 'ERROR: ['.$apidb->error.']'; + $sql = "UPDATE `users` SET `key` = '$key' WHERE `resetkey` = '$resetkey' AND `name` = '$appname';"; + if(!$result = $apidb->query($sql)) return 'ERROR: ['.$apidb->error.']'; return "APIKey reset. Key: $key"; }