Display an error message when a query failed (previous : silent fail...)
This commit is contained in:
parent
b330af258f
commit
b255a8cd90
|
@ -169,13 +169,20 @@ function add_entry($user, $login, $password,
|
|||
$result = $db->query("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES
|
||||
('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')");
|
||||
|
||||
error_log("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES
|
||||
('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')");
|
||||
/* error_log("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES */
|
||||
/* ('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')"); */
|
||||
$db->close();
|
||||
|
||||
if ($result == FALSE)
|
||||
{
|
||||
echo "Error " . $db->lastErrorMsg();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "OK";
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function delete_entry($user, $login, $access_token)
|
||||
|
@ -197,11 +204,20 @@ function delete_entry($user, $login, $access_token)
|
|||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM gpass WHERE login='" . $login . "'");
|
||||
$result = $db->query("DELETE FROM gpass WHERE login='" . $login . "'");
|
||||
$db->close();
|
||||
|
||||
if ($result == FALSE)
|
||||
{
|
||||
echo "Error " . $db->lastErrorMsg();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "OK";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function update_entry($user, $mkey, $old_login, $url, $login, $password, $shadow_login, $salt, $old_access_token, $new_access_token)
|
||||
|
@ -257,7 +273,7 @@ function get_secure_entries($user, $access_tokens)
|
|||
}
|
||||
$query .= ")";
|
||||
|
||||
error_log($query);
|
||||
//error_log($query);
|
||||
$result = $db->query($query);
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
|
Loading…
Reference in New Issue
Block a user