-
Notifications
You must be signed in to change notification settings - Fork 1
/
shock.html
101 lines (90 loc) · 3.52 KB
/
shock.html
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
<?php
header('Content-Type: text/html; charset=utf-8');
include('conn.php');
$kickboard = $_POST['kickboard'];
if(empty($kickboard)) $kickboard = 'SCK06';
$date = $_POST['date'];
if(empty($date)) {
$date = $_COOKIE['date'];
if(empty($date)) $date = date("Y-m-d");
}
setcookie("date", $date, time() + 86400);
$start_time = $_POST['start_time'];
if(empty($start_time)) $start_time = '00:00:00';
$mysql_start_date = DateTime::createFromFormat('Y-m-d H:i:s', $date. $start_time)->format('Y-m-d H:i:s');
$end_time = $_POST['end_time'];
if(empty($end_time)) $end_time = '23:59:59';
$mysql_end_date = DateTime::createFromFormat("Y-m-d H:i:s", $date. $end_time)->format('Y-m-d H:i:s');
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
} else {
echo "CONNECTION SUCCESS\n";
}
?>
<!DOCTYPE html>
<html style="font-size: 16px;">
<head>
<meta charset="utf-8">
<title>SHOCK RECORD</title>
</head>
<body>
<header>
<link rel="stylesheet" href="css/button.css">
<?php include('shock_button.html'); ?>
</header>
<div align="center">
<br>
<form method='post'>
<input type='text' name='kickboard' placeholder='' value='<?php echo $kickboard; ?>' style="color:grey">
<br>
<input type='text' name='date' placeholder='YYYY-mm-dd' value='<?php echo $date; ?>' style="color:grey">
<br>
<input type='text' name='start_time' placeholder='00:00:00' value='<?php echo $start_time; ?>' style="width:120px;color:grey">
~
<input type='text' name='end_time' placeholder='23:59:59' value='<?php echo $end_time; ?>' style="width:120px;color:grey">
<br>
<input type='submit' value='SEARCH'>
</form>
<!-- <form method='post'>
<input type='text' name='yesterday' value="<?php
$yesterday = date('Y-m-d H:i:s', strtotime($date . ' -1 day'));
echo $yesterday;?>" style="text-align: center;">
<input type='submit' value='Yesterday'>
</form> -->
<p><?php
echo $kickboard.
" from ".date($mysql_start_date).
" to ".date($mysql_end_date);
$sql = "SELECT * FROM mark1 WHERE kickboard = '$kickboard' AND (shock_date BETWEEN '$mysql_start_date' AND '$mysql_end_date')";
$result = mysqli_query($conn, $sql);
?>
</p>
<!-- <form method='post'>
<input type='text' name='tomorrow' value="<?php
$tomorrow = date('Y-m-d H:i:s', strtotime($date . ' +1 day'));
echo $tomorrow;?>" readonly style="text-align: center;">
<input type='submit' value='Tomorrow'>
</form> -->
<table align="center" border="1" bordercolor="white" bgcolor="black">
<th width="160px" height="40px" bgcolor="white">
<font size="5">Record No.</font>
</th>
<th width="360px" height="40px" bgcolor="white">
<font size="5">DATE</font>
</th>
<th width="120px" height="40px" bgcolor="white">
<font size="5">shock</font>
</th>
<p><?php
while($rows = mysqli_fetch_array($result) ){
echo '<tr align="center" height="36px" bgcolor="white">';
echo '<td>',$rows['no'],'</td>';
echo '<td>',$rows['shock_date'],'</td>';
echo '<td>',$rows['shock'],'</td>';
echo '</tr>';
}
?></p>
</table>
</div>
</body>
</html>