-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhapus-lamaran.php
87 lines (73 loc) · 1.82 KB
/
hapus-lamaran.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
// mulai session
session_start();
// mulai fungsi
require "functions.php";
// koneksi db
require "db.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- judul -->
<title>Hapus Data Lamaran</title>
<!-- headtags -->
<?php require "headtags.php" ?>
</head>
<body>
<!-- navbar -->
<?php require "navbar.php" ?>
<div class="row mt-5">
<div class="col">
<h3 class="text-center">Sedang Mencoba Menghapus Data Lamaran</h3>
</div>
</div>
<!-- footer -->
<?php require "footer.php" ?>
</body>
</html>
<?php
// jika bukan pelamar atau admin
if (!(isset($_SESSION["pelamar"]) || isset($_SESSION["admin"]))){
echo "
<script>
Swal.fire('Akses Ditolak','Maaf Anda Tidak Diizinkan Mengakses Halaman Ini','warning').then(function(){
window.location = 'index.php';
});
</script>
";
}
if ($_GET["id"] == NULL){
echo "
<script>
Swal.fire('Akses Ditolak','Maaf, Halaman Belum Menerima Inputan ID Lamaran','warning').then(function(){
window.location = 'index.php';
});
</script>
";
}
// ambil get
$id = $_GET["id"];
// hapus data lamaran
mysqli_query($db,"DELETE from lamaran where id = $id");
// jika berhasil di hapus
if (mysqli_affected_rows($db)){
echo "
<script>
Swal.fire('Data Lamaran Berhasil Di Hapus','','success').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}else{
echo "
<script>
Swal.fire('Data Lamaran Gagal Di Hapus','','success').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}
?>