29 lines
643 B
PHP
29 lines
643 B
PHP
<?php
|
|
require_once 'db/config.php';
|
|
require_once 'includes/header.php'; // Para la sesión y seguridad
|
|
|
|
// Verificar permisos
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: /auth/login.php');
|
|
exit;
|
|
}
|
|
|
|
$id = $_GET['id'] ?? null;
|
|
|
|
if (!$id) {
|
|
header('Location: inversiones_operativas.php?error=missing_id');
|
|
exit;
|
|
}
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("DELETE FROM inversiones WHERE id = ?");
|
|
$stmt->execute([$id]);
|
|
|
|
header('Location: inversiones_operativas.php?success=deleted');
|
|
exit;
|
|
} catch (PDOException $e) {
|
|
header('Location: inversiones_operativas.php?error=db_error');
|
|
exit;
|
|
}
|
|
?>
|