mirror of https://github.com/gamaio/UnPS-API.git
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:
parent
afbab7b3c6
commit
ca1532364c
|
@ -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
|
// 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`";
|
$sql = "SELECT * FROM `users`";
|
||||||
if(!$result = $apidb->query($apisql)) return 'ERROR: ['.$apidb->error.']';
|
if(!$result = $apidb->query($sql)) return 'ERROR: ['.$apidb->error.']';
|
||||||
$theapikey = '';
|
$theapikey = '';
|
||||||
while($row = $result->fetch_assoc()){
|
while($row = $result->fetch_assoc()){
|
||||||
$theapikey .= $row['key'].'-';
|
$theapikey .= $row['key'].'-';
|
||||||
|
@ -356,8 +356,8 @@ class api{
|
||||||
}
|
}
|
||||||
// End API key check - FIX THIS SHIT
|
// End API key check - FIX THIS SHIT
|
||||||
|
|
||||||
$sql = "UPDATE `users` SET `apikey` = '$key' WHERE `resetkey` = '$resetkey' AND `name` = '$appname';";
|
$sql = "UPDATE `users` SET `key` = '$key' WHERE `resetkey` = '$resetkey' AND `name` = '$appname';";
|
||||||
if(!$result = $apidb->query($apisql)) return 'ERROR: ['.$apidb->error.']';
|
if(!$result = $apidb->query($sql)) return 'ERROR: ['.$apidb->error.']';
|
||||||
return "APIKey reset. Key: $key";
|
return "APIKey reset. Key: $key";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue