BossBey File Manager
PHP:
8.4.18
OS:
Linux
User:
kids
Root
/
home
/
kids
/
public_html
/
app
š¤ Upload
š New File
š New Folder
Close
Editing: delete.php
<?php // Enable error reporting for debugging purposes //ini_set('display_errors', 1); //ini_set('display_startup_errors', 1); //error_reporting(E_ALL); // Include the database connection require_once "connection.php"; // Debug: Display the POST data // var_dump($_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve the values from POST $id = isset($_POST["id"]) ? $_POST["id"] : null; $origem = isset($_POST["origem"]) ? $_POST["origem"] : null; $voltar = isset($_POST["voltar"]) ? $_POST["voltar"] : null; $tipo = isset($_POST["tipo"]) ? $_POST["tipo"] : null; // Check if all necessary values are present if ($id && $origem) { // Determine the table based on origem switch ($origem) { case "events": $table = "events"; break; case "relatorio": $table = "relatorio"; break; // Add more cases as needed for other tables default: $table = null; break; } // If the table is set, proceed with deletion if ($table) { // Prepare the SQL statement $sql = "DELETE FROM `kids_app`.`$table` WHERE `id` = :id"; $stmt = $pdo->prepare($sql); $stmt->bindParam(":id", $id); // Execute the statement if ($stmt->execute()) { $mensagem = ucfirst($tipo) . " excluĆdo(a) com sucesso!"; echo '<script> alert("' . $mensagem . '"); setTimeout(function() { window.location.href = "' . $voltar . '"; }, 200); // Redirecionar após 0,2 segundos </script>'; exit(); // Importante: Sair após o redirecionamento } else { $mensagem = "Opa! Algo deu errado. Entre em contato com o suporte."; } } else { $mensagem = "Origem invĆ”lida."; } } else { $mensagem = "Dados incompletos."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Delete</title> </head> <body> <?php if (isset($mensagem)): ?> <p><?php echo $mensagem; ?></p> <?php endif; ?> </body> </html>
Save
Cancel