<?php
if ($c['level'] == "superadmin") {
    if (isset($_GET['id'])) {
        $id = intval($_GET['id']);

        $query = mysqli_query($koneksi, "DELETE FROM tb_pemberitahuan WHERE id = '$id'");

        if ($query) {
            ?>
            <script type="text/javascript">
                alert('Pemberitahuan berhasil dihapus');
                window.location = "?page=pemberitahuan";
            </script>
            <?php
        } else {
            ?>
            <script type="text/javascript">
                alert('Gagal menghapus pemberitahuan');
                window.location = "?page=pemberitahuan";
            </script>
            <?php
        }
    }
} else {
    ?>
    <script type="text/javascript">
        window.location = "?page=dashboard";
    </script>
    <?php
}
?>