-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.php
124 lines (114 loc) · 4.08 KB
/
output.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
124
<!-- Header Form -->
<?php include 'partials/_header.php' ?>
<!-- Include Reporting Options -->
<?php include 'lib/crimecount.php' ?>
<?php include 'lib/timeseries.php' ?>
<?php
//############## SERVER FILE ###################################################
//############## CHECK VALUES ##################################################
// Missing Value Check
if (!empty($_POST["long"]) || !empty($_POST["lat"]) || !empty($_POST["rad1"]) || !empty($_POST["rad2"]) || !empty($_POST["month"])) {
$latVal = trim((float)$_POST["lat"]);
$longVal = trim((float)$_POST["long"]);
$radVal1 = trim((float)$_POST["rad1"]);
$radVal2 = trim((float)$_POST["rad2"]);
$mode = $_POST["mode"];
} else {
die("Error Missing Values Found.");
}
// Check that Lat/Long values are in the right range.
if ((-90.00 <= $latVal) && ($latVal <= 90.00)) {
// Needs Condensing
if ((-49.00 <= $latVal) && ($latVal <= 60.00)) {
// Needs Condensing
} else {
die("Only UK Supported.");
}
} else {
die("Latitude needs to be between -90 and 90 degrees.");
}
// Check that Lat/Long values are in the right range.
if ((-180.00 <= $longVal) && ($longVal <= 180.00)) {
// Needs Condensing
if ((-11.00 <= $longVal) && ($longVal <= 1.00)) {
// Needs Condensing
} else {
die("Only Supperted in the UK.");
}
} else {
die("Longitude needs to be between -180 and 180 degrees.");
}
// Check that Radius values are in the right range.
if ($radVal2 <= $radVal1) {
die("Local area is smaller than your Immediate area.");
}
?>
<!-- Container -->
<div id='bodyContainer' class="container">
<!-- Render Table -->
<?php
if ($mode == 0) {
?>
<!-- Toolbar -->
<div id="crimeCountToolbar">
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group mr-2" role="group" aria-label="First group">
<button id='riskSliderToggle' type="button" onclick="toggleRiskSlider()" class="btn btn-secondary">Risk Slider</button>
<button id='riskToggle' type="button" onclick="toggleRiskFactor()" class="btn btn-secondary">Risk</button>
<!-- <button type="button" class="btn btn-secondary">2</button>
<button type="button" class="btn btn-secondary">3</button>
<button type="button" class="btn btn-secondary">4</button> -->
</div>
<div class="btn-group mr-2" role="group" aria-label="Second group">
<button type="button" onclick="window.print()" class="btn btn-secondary"><i class="fas fa-print"></i></button>
<!-- <button type="button" class="btn btn-secondary">6</button>
<button type="button" class="btn btn-secondary">7</button> -->
</div>
<div class="btn-group" role="group" aria-label="Third group">
<!-- <button type="button" class="btn btn-secondary">8</button> -->
</div>
</div>
</div>
<br>
<!-- Block Header -->
<h2>Crime Counter</h2>
<!-- Table -->
<table class='table col-md-6'>
<tbody>
<tr>
<td><b>Location:</b></td>
<td><?php echo $latVal ?>, <?php echo $longVal ?></td>
</tr>
<tr>
<td><b>Generated:</b></td>
<td><?php echo date("d/m/y") ?></td>
</tr>
</tbody>
</table>
<?php
echo crimeCounter($mysqli, $latVal, $longVal, $radVal1, $radVal2); // Crime Count
}
if ($mode == 1) {
?>
<h2>Time Series</h2>
<table class='table col-md-6'>
<tbody>
<tr>
<td><b>Location:</b></td>
<td><?php echo $latVal ?>, <?php echo $longVal ?></td>
</tr>
<tr>
<td><b>Generated:</b></td>
<td><?php echo date("d/m/y") ?></td>
</tr>
</tbody>
</table>
<?php
echo timeSeries($mysqli, $latVal, $longVal, $radVal1); // Time Series
}
?>
</div>
<!-- Footer -->
<?php include 'partials/_footer.php' ?>
</body>
</html>