-
Notifications
You must be signed in to change notification settings - Fork 0
/
pengajuan_hapus.php
41 lines (27 loc) · 1.01 KB
/
pengajuan_hapus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
session_start();
// jika waktu session habis (tak set 30m)
if (!isset($_SESSION['EXPIRES']) || time() >= $_SESSION['EXPIRES']) {
session_destroy();
$_SESSION = array();
}
if (!isset($_SESSION["id_pegawai"]) || $_SESSION['nama_jabatan'] == 'Kepala Bidang' || $_SESSION['nama_jabatan'] == 'Kepala Ruangan' || $_SESSION['nama_jabatan'] == 'Admin') {
header("location:login.php");
} else {
$id_pengajuan = $_GET['id_pengajuan'];
require './dbConnection.php';
try {
$sql = 'DELETE FROM tb_pengajuan
WHERE id_pengajuan = :id_pengajuan';
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':id_pengajuan', $id_pengajuan, PDO::PARAM_STR);
if ($stmt->execute() === FALSE) {
echo 'Could not save information to the database';
}
} catch (PDOException $e) {
echo 'Database Error '. $e->getMessage(). ' in '. $e->getFile().
': '. $e->getLine();
}
header("location:pengajuan.php");
}
?>