-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkcheckout.php
57 lines (50 loc) · 1.32 KB
/
checkcheckout.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
<?php
require_once('connect.php');
$serviceId = $_GET['serviceId'];
$memberId = $_GET['memberId'];
$totalPrice = $_GET['totalPrice'];
$q="SELECT curdate() as currentDate";
$currentDate = 0;
if ($res = $mysqli->query($q))
{
if (mysqli_num_rows($res) == 1)
{
$row = $res->fetch_array();
$currentDate=$row['currentDate'];
}
}
if($memberId != 9999){
echo "string";
$q="SELECT * from `member` where memberId ='$memberId' ";
$currentBonusPoint = 0;
$currentM_Type = 1;
if ($res = $mysqli->query($q))
{
if (mysqli_num_rows($res) == 1)
{
$row = $res->fetch_array();
$currentBonusPoint=$row['bonusPoint'];
$currentM_Type = $row['memberTypeId'];
}
}
$currentBonusPoint= $currentBonusPoint+intval($totalPrice);
if($currentBonusPoint > 800){
$currentM_Type=2;
}
if($currentBonusPoint > 2000){
$currentM_Type=3;
}
$q = "update member set bonusPoint='$currentBonusPoint',memberTypeId='$currentM_Type' where memberId =$memberId";
if(!$mysqli->query($q)){
echo "Update failed: ". $mysqli->error;
}else{
header("Location: checkoutitems.php");
}
}
$q = "update laundryservice set dateOut='$currentDate' where serviceId =$serviceId";
if(!$mysqli->query($q)){
echo "Update failed: ". $mysqli->error;
}else{
header("Location: checkoutitems.php");
}
?>