|
@@ -0,0 +1,103 @@
|
|
1
|
+<?PHP
|
|
2
|
+
|
|
3
|
+ if (!isset($_GET['imei']) || !ctype_digit($_GET['imei'])) {
|
|
4
|
+ // TODO: Better error
|
|
5
|
+ die('Invalid IMEI');
|
|
6
|
+ }
|
|
7
|
+
|
|
8
|
+ define('IMEI', $_GET['imei']);
|
|
9
|
+
|
|
10
|
+ require_once('common.php');
|
|
11
|
+
|
|
12
|
+ $sql = 'SELECT log_activity, log_id, log_statuscode FROM sensorlogger WHERE log_imei = \'' . m(IMEI) . '\'';
|
|
13
|
+ $res = mysql_query($sql);
|
|
14
|
+
|
|
15
|
+ echo '<?xml version="1.0"?>';
|
|
16
|
+?>
|
|
17
|
+<html xmlns="http://www.w3.org/1999/xhtml">
|
|
18
|
+ <head>
|
|
19
|
+ <title>SensorLogger Results</title>
|
|
20
|
+ <link rel="stylesheet" type="text/css" href="/style.css"/>
|
|
21
|
+ <style type="text/css">
|
|
22
|
+ .qr { float: left; clear: left; margin-right: 15px; }
|
|
23
|
+ .qr img { width: 128px; }
|
|
24
|
+ </style>
|
|
25
|
+ </head>
|
|
26
|
+ <body style="margin-top: 0; padding-top: 0;">
|
|
27
|
+ <h1 style="background: url('android.png') no-repeat right; padding-top: 50px; margin-top: 0;">SensorLogger results for <span><?PHP echo IMEI; ?></span></h1>
|
|
28
|
+ <div>
|
|
29
|
+<?PHP if (($num = mysql_num_rows($res)) == 0) { ?>
|
|
30
|
+ <h2>Welcome</h2>
|
|
31
|
+ <p>
|
|
32
|
+ You do not appear to have submitted any data from the sensor logger application, yet.
|
|
33
|
+ </p>
|
|
34
|
+ <p>
|
|
35
|
+ Why not <a href="/android/">download it</a> and give it a try, then check back soon!
|
|
36
|
+ </p>
|
|
37
|
+<?PHP } else { ?>
|
|
38
|
+ <h2>Thank you</h2>
|
|
39
|
+ <p>
|
|
40
|
+ You've submitted <strong><?PHP echo number_format($num); ?></strong>
|
|
41
|
+ record<?PHP echo $num == 1 ? '' : 's'; ?> from the sensor logger application.
|
|
42
|
+ </p>
|
|
43
|
+<?PHP
|
|
44
|
+ $data = array();
|
|
45
|
+ $codes = array();
|
|
46
|
+ $rejects = 0;
|
|
47
|
+
|
|
48
|
+ while ($row = mysql_fetch_assoc($res)) {
|
|
49
|
+ if ($row['log_statuscode'] == '1') {
|
|
50
|
+ $data[] = $row;
|
|
51
|
+ } else {
|
|
52
|
+ $codes[(int) $row['log_statuscode']]++;
|
|
53
|
+ $rejects++;
|
|
54
|
+ }
|
|
55
|
+ }
|
|
56
|
+
|
|
57
|
+ if ($rejects > 0) {
|
|
58
|
+?>
|
|
59
|
+ <p>
|
|
60
|
+ Unfortunately, some of these traces have been rejected as they are not suitable for analysis:
|
|
61
|
+ </p>
|
|
62
|
+ <ul>
|
|
63
|
+<?PHP
|
|
64
|
+ foreach ($codes as $code => $count) {
|
|
65
|
+ echo '<li>', number_format($count), ' rejected because ' . getStatusCodeReason($code) . '</li>';
|
|
66
|
+ }
|
|
67
|
+?>
|
|
68
|
+ </ul>
|
|
69
|
+<?PHP if ($num > $rejects) { ?>
|
|
70
|
+ <p>The remaining <strong><?PHP echo $num - $rejects; ?></strong> record<?PHP echo $num > $rejects + 1 ? 's look' : ' looks'; ?>
|
|
71
|
+ good, and <?PHP echo $num > $rejects + 1 ? 'are' : 'is'; ?> shown below:</p>
|
|
72
|
+<?PHP } else { ?>
|
|
73
|
+ <p>Oh dear, that's all of your records. Make sure you're using the <a href="/android/">latest version</a>
|
|
74
|
+ to ensure you get the best results. Record some more and check back soon!</p>
|
|
75
|
+<?PHP }
|
|
76
|
+ } else {
|
|
77
|
+?>
|
|
78
|
+ <p>Our system didn't find any problems with your records, so all of them are shown below:</p>
|
|
79
|
+<?PHP
|
|
80
|
+ }
|
|
81
|
+
|
|
82
|
+ if ($rejects < $num) {
|
|
83
|
+?>
|
|
84
|
+ <h2>Your records</h2>
|
|
85
|
+<?PHP
|
|
86
|
+
|
|
87
|
+ foreach ($data as $datum) {
|
|
88
|
+ echo '<h3>', htmlentities($datum['log_activity']), '</h3>';
|
|
89
|
+ echo '<div style="height: 700px; overflow: auto;">';
|
|
90
|
+ echo '<img src="data.php?graph=' . $datum['log_id'] . '&ds=1" height="330" alt="Graph of accelerometer data"/><br/>';
|
|
91
|
+ echo '<img src="data.php?graph=' . $datum['log_id'] . '&ds=2" height="330" alt="Graph of magnetic fielddata"/>';
|
|
92
|
+ echo '</div>';
|
|
93
|
+ }
|
|
94
|
+?>
|
|
95
|
+ <h2>Check back soon...</h2>
|
|
96
|
+ <p>for information on how your records are being used, explanations of the data, and information on the application
|
|
97
|
+ which will be created as a result</p>
|
|
98
|
+<?PHP } ?>
|
|
99
|
+<?PHP } ?>
|
|
100
|
+ </div>
|
|
101
|
+ <div id="footer"/>
|
|
102
|
+ </body>
|
|
103
|
+</html>
|