forked from charu25/beer-factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime.php
126 lines (82 loc) · 1.87 KB
/
time.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
include_once("config.lib.php");
if(isset($_POST['backorder'])){
$curr=$_POST['curr'];
$rno=$_POST['round'];
$sql='SELECT sum(placedorder) as backsum from player where seen=0 and sendto='.$curr.' and round<'.$rno.'';
$result=mysqli_query($conn,$sql);
$found=mysqli_num_rows($result);
if($found>0){
$row=mysqli_fetch_array($result);
echo $row['backsum'];
$query ="UPDATE player SET seen='1' WHERE sendto = '$curr' AND seen='0' AND `round`<'$rno'";
$result=mysqli_query($conn,$query);
}
else{
echo '0';}
}
if(isset($_POST['orderseen'])){
$curr=$_POST['curr'];
$rno=$_POST['round'];
$x=$rno-1;
$clms='r'.$x;
$x=$x-1;
while($x>0){
$clms=$clms.'+'.'r'.$x;
$x--;}
$sql='SELECT sum('.$clms.') as psum,r'.$rno.' as porder from orders where id='.$curr.'';
$result=mysqli_query($conn,$sql);
$found=mysqli_num_rows($result);
if($found>0){
$row=mysqli_fetch_array($result);
echo $row['psum']." ".$row['porder'];
}
}
if(isset($_POST['mancheck']))
{
$var = date("H:i");
echo $var; echo " ";
$sql="SELECT *
FROM `timecheck`
WHERE DATE = '2015-02-13'
AND TIME <= '$var'
ORDER BY TIME DESC
LIMIT 1";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result);
$sno=$row['sno'];
echo $sno; echo " ";
echo $row['time']; echo " ";
/*$sql= "SELECT * FROM `customerdemandseen` WHERE sno=1";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result);
$x=$sno;
//echo $row[$seen];
$flag=0;
while($x>0)
{
//echo $x; $x=$x-1;
$seen="r".$x;
if($row[$seen]==0)
{$x=$x-1;}
else {$flag=1;break;}
}
echo $x+1;*/
}
if(isset($_POST['roundupdate']))
{
$var = date("H:i");
echo $var; echo " ";
$sql="SELECT *
FROM `timecheck`
WHERE DATE = '2015-02-13'
AND TIME <= '$var'
ORDER BY TIME DESC
LIMIT 1";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result);
$sno=$row['sno'];
echo $sno; echo " ";
echo $row['time']; echo " ";
}
?>