Mini Kabibi Habibi
Current Path : C:/xampp/htdocs/cid/system/ |
|
Current File : C:/xampp/htdocs/cid/system/delete_monthly_report.php |
<?php
session_start();
@include 'include/config.php';
// Check if user is logged in
if (!isset($_SESSION['username_school'])) {
header("Location: login.php");
exit();
}
$username = $_SESSION['username_school'];
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
// Verify that the report belongs to the user before deleting
$stmt = $conn->prepare("DELETE FROM monthly_accomplishment_reports WHERE id = ? AND username = ?");
$stmt->bind_param("is", $id, $username);
if ($stmt->execute()) {
$_SESSION['success'] = "Monthly report deleted successfully.";
} else {
$_SESSION['error'] = "Failed to delete monthly report.";
}
$stmt->close();
} else {
$_SESSION['error'] = "Invalid request.";
}
// Redirect back to the monthly reports page
header("Location: monthly_reports.php");
exit();
?>