<?php

session_start();

if(!isset($_SESSION['role'])){

    header("Location: ../index.php");
    exit;
}

if($_SESSION['role'] != 'admin'){

    header("Location: ../index.php");
    exit;
}

include '../config/koneksi.php';

$id = intval($_GET['id']);

$cek = mysqli_query(
$conn,
"SELECT * FROM laporan
WHERE id='$id'"
);

if(mysqli_num_rows($cek)==0){
    die("Data laporan tidak ditemukan");
}

mysqli_query($conn,
"UPDATE laporan 
SET status='disetujui'
WHERE id='$id'");

header("Location: validasi.php");

?>