-
Notifications
You must be signed in to change notification settings - Fork 1
/
searchByDate.php
56 lines (47 loc) · 1.26 KB
/
searchByDate.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
<?php
include('header.php');
global $mysqli;
$date = $_GET['date'];
$starttime = $date . ' 00:00:00';
$endtime = $date . ' 23:59:59';
$sql = "SELECT * FROM auth, sessions WHERE auth.session = sessions.id AND starttime BETWEEN '$starttime' AND '$endtime'";
if (!$result = $mysqli->query($sql)) {
echo "Couldn't run that query";
echo $mysqli->connect_error;
}
if ($result->num_rows === 0) {
echo "No matches";
}
?>
<table>
<tr>
<td>ID</td>
<td>Start Time</td>
<td>End Time</td>
<td>Sensor</td>
<td>Username</td>
<td>Password</td>
<td>IP</td>
</tr>
<?php
while($attempt = $result->fetch_assoc()) {
$list['id'] = $attempt['id'];
$list['starttime'] = $attempt['starttime'];
$list['endtime'] = $attempt['endtime'];
$list['sensor'] = $attempt['sensor'];
echo "<tr>";
echo "<td>".$attempt['id']."</td>";
echo "<td>".$attempt['starttime']."</td>";
echo "<td>".$attempt['endtime']."</td>";
echo "<td>".$attempt['sensor']."</td>";
echo "<td>".$attempt['username']."</td>";
echo "<td>".$attempt['password']."</td>";
echo "<td>".$attempt['ip']."</td>";
echo "</tr>";
}
?>
<?php
foreach($list as $i) {
}
?>
</table>