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
|
$result = $db->query("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES
|
||||||
('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')");
|
('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')");
|
||||||
|
|
||||||
error_log("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES
|
/* error_log("INSERT INTO gpass ('login', 'password', 'shadow_login', 'salt', 'access_token') VALUES */
|
||||||
('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')");
|
/* ('" . $login . "', '" . $password . "', '" . $shadow_login . "', '" . $salt . "', '" . $access_token . "')"); */
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
if ($result == FALSE)
|
||||||
|
{
|
||||||
|
echo "Error " . $db->lastErrorMsg();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
echo "OK";
|
echo "OK";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_entry($user, $login, $access_token)
|
function delete_entry($user, $login, $access_token)
|
||||||
|
@ -197,11 +204,20 @@ function delete_entry($user, $login, $access_token)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->query("DELETE FROM gpass WHERE login='" . $login . "'");
|
$result = $db->query("DELETE FROM gpass WHERE login='" . $login . "'");
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
if ($result == FALSE)
|
||||||
|
{
|
||||||
|
echo "Error " . $db->lastErrorMsg();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
echo "OK";
|
echo "OK";
|
||||||
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)
|
||||||
|
@ -257,7 +273,7 @@ function get_secure_entries($user, $access_tokens)
|
||||||
}
|
}
|
||||||
$query .= ")";
|
$query .= ")";
|
||||||
|
|
||||||
error_log($query);
|
//error_log($query);
|
||||||
$result = $db->query($query);
|
$result = $db->query($query);
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user