31 lines
856 B
PHP
31 lines
856 B
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
// Proteksi halaman: hanya untuk Petugas Pajak
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'Petugas Pajak') {
|
|
header("Location: login.php");
|
|
exit();
|
|
}
|
|
|
|
$report_id = $_GET['id'] ?? null;
|
|
$action = $_GET['action'] ?? null;
|
|
|
|
if ($report_id && ($action === 'approve' || $action === 'reject')) {
|
|
$new_status = ($action === 'approve') ? 'Approved' : 'Rejected';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("UPDATE tax_reports SET status = :status WHERE id = :id");
|
|
$stmt->execute([':status' => $new_status, ':id' => $report_id]);
|
|
} catch (PDOException $e) {
|
|
// Sebaiknya log error ini di production
|
|
die("Database error: " . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
// Redirect kembali ke dashboard
|
|
header("Location: dashboard.php");
|
|
exit();
|
|
?>
|