More work on moving to the redirect, flash_alert and get_field_by_id and maing sure validate_csrf is on top and some other cleanups, along with more work on credits

This commit is contained in:
johnnyq
2025-08-04 17:01:19 -04:00
parent b4e5e3fda7
commit e39072d3bc
23 changed files with 465 additions and 720 deletions

View File

@@ -74,10 +74,9 @@ if (isset($_POST['add_service'])) {
}
}
// Logging
logAction("Service", "Create", "$session_name created service $service_name", $client_id, $service_id);
$_SESSION['alert_message'] = "Service <strong>$service_name</strong> created";
flash_alert("Service <strong>$service_name</strong> created");
redirect();
@@ -158,10 +157,9 @@ if (isset($_POST['edit_service'])) {
}
}
// Logging
logAction("Service", "Edit", "$session_name edited service $service_name", $client_id, $service_id);
$_SESSION['alert_message'] = "Service <strong>$service_name</strong> edited";
flash_alert("Service <strong>$service_name</strong> edited");
redirect();
@@ -169,9 +167,10 @@ if (isset($_POST['edit_service'])) {
if (isset($_GET['delete_service'])) {
enforceUserPermission('module_support', 3);
validateCSRFToken($_GET['csrf_token']);
enforceUserPermission('module_support', 3);
$service_id = intval($_GET['delete_service']);
// Get Service Details
@@ -183,11 +182,9 @@ if (isset($_GET['delete_service'])) {
// Delete service
mysqli_query($mysqli, "DELETE FROM services WHERE service_id = $service_id");
// Logging
logAction("Service", "Delete", "$session_name deleted service $service_name", $client_id);
$_SESSION['alert_type'] = "error";
$_SESSION['alert_message'] = "Service <strong>$service_name</strong> deleted";
flash_alert("Service <strong>$service_name</strong> deleted", 'error');
redirect();