Estiliza pagina de upload externo - responsiva (novo47)
This commit is contained in:
1 parent
05cd7b9c79
commit
631afa1c46
15 files changed
+1818
-24
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require_once 'config.php';
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$doc_id = intval($_GET['id']);
|
||||
|
||||
// Buscar informações do documento
|
||||
$sql = "SELECT arquivo, client_id FROM documentos WHERE id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("i", $doc_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($doc = $result->fetch_assoc()) {
|
||||
// Deletar arquivo físico
|
||||
if (file_exists($doc['arquivo'])) {
|
||||
unlink($doc['arquivo']);
|
||||
}
|
||||
|
||||
// Deletar registro do banco
|
||||
$sql = "DELETE FROM documentos WHERE id = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("i", $doc_id);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
header("Location: index.php?page=doc_list&client_id=" . $doc['client_id'] . "&status=deleted");
|
||||
} else {
|
||||
die("Erro ao excluir documento: " . $stmt->error);
|
||||
}
|
||||
} else {
|
||||
die("Documento não encontrado");
|
||||
}
|
||||
} else {
|
||||
die("ID do documento não fornecido");
|
||||
}
|
||||
?>
|
||||
Reference in new issue
Block a user