-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrcode.php
73 lines (62 loc) · 1.29 KB
/
qrcode.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
<?php
require "init.php";
date_default_timezone_set("Asia/Calcutta");
if(!$_POST["data"])
{
echo "No Permission to access this page!";
exit();
}
$d=array();
$data=$_POST["data"];
//echo $data;
$d=explode(" ",$data);
foreach($d as $key=>$values)
{
//echo "$key:$values\n";
switch($key)
{
case 0: $username=$values;
break;
case 1: $transid=$values;
break;
case 2: $slotid=$values;
break;
case 3: $dat=$values;
break;
case 4: $tim=$values;
break;
}
}
$dat=date('Y-m-d',strtotime($dat));
$tim=date('H:i:s',strtotime($tim));
$tstamp=date("Y-m-d H:i:s");
$sql2="select transid from bookingslot where transid='$transid' and entry=0;";
$result2=mysqli_query($con,$sql2);
if(!$result2)
{
echo "\nError";
}
else
{
$row=mysqli_fetch_row($result2);
if(is_null($row[0]))
{
echo "\nQR code already used!";
mysqli_close($con);
exit();
}
$sql3="update bookingslot set entry=1 where transid='$transid';";
mysqli_query($con,$sql3);
$sql="insert into qrcode(transid,username,slotid,dat,tim,tstamp) values('$transid','$username','$slotid','$dat','$tim','$tstamp')";
$result=mysqli_query($con,$sql);
if(!$result)
{
echo "\nError";
}
else
{
echo "\nSuccessfull";
}
}
mysqli_close($con);
?>