mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
@@ -170,7 +170,7 @@ function deleteMessage() {
|
||||
var id = tr.attr("data-id");
|
||||
|
||||
utils.disableAll();
|
||||
utils.showAlert("info", "", "Deleting message # ", id);
|
||||
utils.showAlert("info", "", "Deleting message with ID " + parseInt(id, 10), "...");
|
||||
$.ajax({
|
||||
url: "scripts/pi-hole/php/message.php",
|
||||
method: "post",
|
||||
|
||||
@@ -42,10 +42,9 @@ function JSON_error($message = null)
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'delete_message') {
|
||||
if ($_POST['action'] == 'delete_message' && isset($_POST['id'])) {
|
||||
// Delete message identified by ID
|
||||
try {
|
||||
$db->query('BEGIN TRANSACTION;');
|
||||
|
||||
$stmt = $db->prepare('DELETE FROM message WHERE id=:id');
|
||||
if (!$stmt) {
|
||||
@@ -60,9 +59,6 @@ if ($_POST['action'] == 'delete_message') {
|
||||
throw new Exception('While executing message statement: ' . $db->lastErrorMsg());
|
||||
}
|
||||
|
||||
if(!$db->query('COMMIT;')) {
|
||||
throw new Exception('While commiting changes to the database: ' . $db->lastErrorMsg());
|
||||
}
|
||||
|
||||
$reload = true;
|
||||
JSON_success();
|
||||
|
||||
Reference in New Issue
Block a user