-
Notifications
You must be signed in to change notification settings - Fork 1
/
konfirmasi.php
102 lines (89 loc) · 2.85 KB
/
konfirmasi.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
// panggil koneksi db
require "db.php";
// panggil file functions.php
require "functions.php";
// aktifkan session
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<?php require "headtags.php" ?>
</head>
<body>
<!-- navbar -->
<?php require "navbar.php" ?>
<div class="row mt-5">
<div class="col text-center">
<h3>Sistem Sedang Mengkonfirmasi Lamaran</h3>
</div>
</div>
<!-- footer -->
<?php require "footer.php" ?>
</body>
</html>
<?php
// jika bukan login pelamar
if (!isset($_SESSION["pelamar"])){
echo "
<script>
Swal.fire('Akses Ditolak !','Anda Tidak Diizinkan Untuk Mengakses Halaman Ini','warning').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}else if (isset($_GET["id"]) == NULL){
echo "
<script>
Swal.fire('Halaman Error !','Halaman Tidak Menerima Informasi Pelamar','error').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}else {
// ambil data yg login
$email = $_SESSION["pelamar"];
$pelamar = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from pelamar where email = '$email'"));
// ambil data yg punya loker
$id = $_GET["id"];
$lamaran = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from lamaran where id = $id"));
// cek apakah yg login benar yg punya lamaran
if ($pelamar["id"] != $lamaran["idPelamar"]){
echo "
<script>
Swal.fire('Akses Ditolak !','Anda Tidak Diizinkan Untuk Mengakses Halaman Ini','warning').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}else{
// cek jika lamaran masih menunggu
$id = $_GET["id"];
$lamaran = mysqli_fetch_assoc(mysqli_query($db, "SELECT * from lamaran where id = $id"));
if ($lamaran["status"] == "Menunggu"){
echo "
<script>
Swal.fire('Aksi Ditolak !','Status Loker Masih Menunggu Bro. Sabarlah Sikit !','warning').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}else{
mysqli_query($db, "UPDATE lamaran set konfirmasi = 1 where id = $id");
if (mysqli_affected_rows($db)){
echo "
<script>
Swal.fire('Konfirmasi Berhasil !','','success').then(function(){
window.location = 'data-lamaran.php';
});
</script>
";
}
}
}
}
?>