-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·112 lines (96 loc) · 3.63 KB
/
index.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
<?php
include 'database.php';
$sql = "SELECT * FROM reports WHERE resolved = 0";
$result = $conn->query($sql);
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Active Reports</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/JavaScript">
function get_request(phone, time){
var xhr = new XMLHttpRequest();
xhr.open('GET', "resolve.php?time=" + time + "&phone=" + phone, true);
xhr.send();
location.reload();
}
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Dragonhacks Project</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Active Reports
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="past.php">Past Reports</a>
</li>
<li class="nav-item">
<a class="nav-link" href="map.php">Map</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<br>
<h1 class="mt-5">Active Reports</h1>
<br>
<table class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Email</th>
<th>Latitude</th>
<th>Longitude</th>
<th>Severity</th>
<th>Time</th>
<th>Resolve?</th>
</tr>
</thead>
<?php
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>".$row["cust_name"]."</td>";
echo "<td>".$row["cust_address"]."</td>";
echo "<td>".$row["cust_phone"]."</td>";
echo "<td>".$row["cust_email"]."</td>";
echo "<td>".$row["cord_lat"]."</td>";
echo "<td>".$row["cord_long"]."</td>";
echo "<td>".$row["severity"]."</td>";
echo "<td>".date("F j, Y, g:i a", (int)$row["time"])."</td>";
echo "<td><button type=\"button\" class=\"btn btn-success\" onclick=\"get_request(".$row["cust_phone"].",".$row["time"].")\" >Resolve</button></a></td>";
echo "</tr>";
}
}
?>
</table>
<br> </br>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
</body>
</html>