-
Notifications
You must be signed in to change notification settings - Fork 0
/
jabatan_hapus.php
41 lines (27 loc) · 917 Bytes
/
jabatan_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'] != 'Admin') {
header("location:login.php");
} else {
$id_jabatan = $_GET['id_jabatan'];
require './dbConnection.php';
try {
$sql = 'DELETE FROM tb_jabatan
WHERE id_jabatan = :id_jabatan';
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':id_jabatan', $id_jabatan, 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:jabatan.php");
}
?>