Dashboard

Current Threads

You are not allowed to delete log entries. (insufficient permissions)
'; }else{ $id=htmlspecialchars($_GET["delete"]); $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "DELETE FROM vir_notify WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $id); // Execute the statement $stmt->execute(); $stmt->close(); $conn->close(); echo ''; } } if(isset($_GET["delete_all"])){ if($perms[3]!=="1"){ echo ''; }else{ $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "DELETE FROM vir_notify"; $stmt = $conn->prepare($sql); // Execute the statement $stmt->execute(); $stmt->close(); $conn->close(); echo ''; } } // Define page size and current page $page_size = 50; $current_page = htmlspecialchars(isset($_GET['page']) ? intval($_GET['page']) : 1); $offset = ($current_page - 1) * $page_size; // Get total number of log entries based on filters $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT count(vir_notify.id) AS log_count FROM machines,vir_notify WHERE machine_name=machine_id AND machine_location LIKE ? AND path LIKE ? AND hash LIKE ? AND machine_id LIKE ? AND action LIKE ?"; $stmt = $conn->prepare($sql); $path = "%" . $path . "%"; $hash = "%" . $hash . "%"; $machine_id = "%" . $machine_id . "%"; $machine_location = "%" . $machine_location . "%"; $action = "%" . $action . "%"; $stmt->bind_param("sssss",$machine_location, $path, $hash, $machine_id, $action); $stmt->execute(); $result = $stmt->get_result(); $row = $result->fetch_assoc(); $total_entries = $row["log_count"]; // Calculate total pages $total_pages = ceil($total_entries / $page_size); // Query log entries for the current page with filters $sql = "SELECT * FROM machines,vir_notify WHERE machine_location LIKE ? AND path LIKE ? AND hash LIKE ? AND machine_id LIKE ? AND action LIKE ? AND machine_name=machine_id ORDER BY vir_notify.id DESC LIMIT ?, ?"; $stmt = $conn->prepare($sql); $path = "%" . $path . "%"; $hash = "%" . $hash . "%"; $machine_id = "%" . $machine_id . "%"; $machine_location = "%" . $machine_location . "%"; $action = "%" . $action . "%"; $stmt->bind_param("sssssii",$machine_location, $path, $hash, $machine_id, $action, $offset, $page_size); $stmt->execute(); $result = $stmt->get_result(); // Display log entries echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; // Display filter options echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; while($row = $result->fetch_assoc()) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
Entry idMachine idLocationFileHashAction takenDelete entry
' . $row["id"] . '' . $row["machine_id"] . '' . $row["machine_location"] . '' . $row["path"] . '' . $row["hash"] . '' . $row["action"] . 'delete
'; $conn->close(); // Display pagination links with filter query echo ''; ?>