|
@@ -2,7 +2,7 @@
|
2
|
2
|
|
3
|
3
|
require_once('common.php');
|
4
|
4
|
|
5
|
|
- define('VERSION', 18);
|
|
5
|
+ define('VERSION', 24);
|
6
|
6
|
|
7
|
7
|
function processSensorLogger($records = true) {
|
8
|
8
|
$sql = $records ? 'SELECT record_id, record_ip, record_headers, record_data FROM unprocessed'
|
|
@@ -50,6 +50,7 @@
|
50
|
50
|
} else if (count(explode("\n", $row['record_data'])) < 500) {
|
51
|
51
|
$statuscode = 7;
|
52
|
52
|
} else {
|
|
53
|
+ // Check for duplicates
|
53
|
54
|
$sql2 = 'SELECT COUNT(*) FROM sensorlogger WHERE LEFT(log_data, ' . strlen($row['record_data']) . ')';
|
54
|
55
|
$sql2 .= ' = LEFT(\'' . m($row['record_data']) . '\', ' . strlen($row['record_data']) . ')';
|
55
|
56
|
|
|
@@ -63,7 +64,25 @@
|
63
|
64
|
if ($num2 > 0) {
|
64
|
65
|
$statuscode = 8;
|
65
|
66
|
} else {
|
66
|
|
- $statuscode = 1;
|
|
67
|
+ $error = false;
|
|
68
|
+
|
|
69
|
+ // Check for repeated data
|
|
70
|
+ $last = array(); $lastcount = array();
|
|
71
|
+ foreach (explode("\n", $row['record_data']) as $line) {
|
|
72
|
+ $bits = explode(',', trim(substr($line, strpos($line, ':'))));
|
|
73
|
+ foreach ($bits as $o => $bit) {
|
|
74
|
+ if (empty($bit)) { continue; }
|
|
75
|
+ if ($last[$o] == $bit) { $lastcount[$o]++; } else { $lastcount[$o] = 0; }
|
|
76
|
+ $last[$o] = $bit;
|
|
77
|
+ }
|
|
78
|
+
|
|
79
|
+ if (max($lastcount) > 200) {
|
|
80
|
+ $error = true;
|
|
81
|
+ break;
|
|
82
|
+ }
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ $statuscode = $error ? 9 : 1;
|
67
|
86
|
}
|
68
|
87
|
}
|
69
|
88
|
|