/home/techb158/workloadmatch.com/Admin
Edit: /home/techb158/workloadmatch.com/Admin/logs.php (10017B)
query("SELECT COUNT(*) FROM activity_logs");
if ($cnt) { $totalLogs = $cnt->fetch_row()[0]; }
// Clear old logs
if (isset($_POST['clear_old_logs'])) {
$days = intval($_POST['days']);
if ($days > 0) {
$stmt = $mysqli->prepare("DELETE FROM activity_logs WHERE created_at < NOW() - INTERVAL ? DAY");
$stmt->bind_param('i', $days);
if ($stmt->execute()) {
$deleted = $stmt->affected_rows;
set_flash_msg("Deleted $deleted log entries older than $days days.", 'success');
log_activity($mysqli, 'clear_old_logs', 'logs', null, "Cleared logs older than $days days");
} else {
set_flash_msg('Error clearing logs.', 'danger');
}
$stmt->close();
} else {
set_flash_msg('Invalid number of days.', 'warning');
}
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}
?>
Admin | Activity Logs
| ID |
User ID |
User Role |
Action |
Target Type |
Target Name |
Status |
IP |
Date |
query("SELECT * FROM activity_logs ORDER BY created_at DESC");
if ($logs):
while ($row = $logs->fetch_assoc()):
$statusLabel = $row['status'] === 'success' ? 'Success' : ($row['status'] === 'error' ? 'Error' : '' . htmlspecialchars($row['status'] ?? '') . '');
?>
|
|
|
|
|
|
|
|
|