-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmasuk_act.php
49 lines (38 loc) · 1.12 KB
/
masuk_act.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
<?php
// menghubungkan dengan koneksi
include 'koneksi.php';
// menangkap data yang dikirim dari form
$customer_email = mysqli_real_escape_string($koneksi, $_POST['customer_email']);
$customer_password = mysqli_real_escape_string($koneksi, $_POST['customer_password']);
$query = "
SELECT *
FROM customer
WHERE
(
customer_email='$customer_email' OR
no_ktp='$customer_email'
) AND
customer_password=md5('$customer_password')";
$login = mysqli_query($koneksi, $query);
$cek = mysqli_num_rows($login);
if($cek > 0){
session_start();
$data = mysqli_fetch_assoc($login);
// hapus session yg lain, agar tidak bentrok dengan session customer
//unset($_SESSION['id']);
unset($_SESSION['nama']);
unset($_SESSION['username']);
unset($_SESSION['status']);
// buat session customer
$_SESSION['customer_id'] = $data['no_ktp'];
$_SESSION['customer_status'] = "login";
if(isset($_SESSION['booking_kamar_status'])){
if($_SESSION['booking_kamar_status'] == "tersedia"){
header("location:checkout.php?alert=login");
}
}else{
header("location:customer.php");
}
}else{
header("location:masuk.php?alert=gagal");
}