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
This commit is contained in:
Arctic Code 2013-07-26 23:34:49 -05:00
parent afbab7b3c6
commit ca1532364c
1 changed files with 3 additions and 3 deletions

View File

@ -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";
}