Database access optimization if there is no shadow logins

This commit is contained in:
Grégory Soutadé 2017-04-17 20:37:26 +02:00
parent 6d2e202aff
commit 241867e93c

View File

@ -215,6 +215,8 @@ function delete_entry($user, $login, $access_token)
return false; return false;
} }
if ($USE_SHADOW_LOGINS)
{
$db_ac = $db->querySingle("SELECT access_token FROM gpass WHERE login='" . $login . "'"); $db_ac = $db->querySingle("SELECT access_token FROM gpass WHERE login='" . $login . "'");
if (strlen($db_ac) != 0 && strcmp($db_ac, $access_token)) if (strlen($db_ac) != 0 && strcmp($db_ac, $access_token))
{ {
@ -222,8 +224,8 @@ function delete_entry($user, $login, $access_token)
echo "Bad access token"; echo "Bad access token";
return false; return false;
} }
else }
{
$result = $db->query("DELETE FROM gpass WHERE login='" . $login . "'"); $result = $db->query("DELETE FROM gpass WHERE login='" . $login . "'");
$db->close(); $db->close();
@ -238,7 +240,6 @@ function delete_entry($user, $login, $access_token)
return true; return true;
} }
} }
}
function update_entry($user, $mkey, $old_login, $url, $login, $password, $shadow_login, $salt, $old_access_token, $new_access_token) function update_entry($user, $mkey, $old_login, $url, $login, $password, $shadow_login, $salt, $old_access_token, $new_access_token)
{ {