Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
714 B

​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
  5. $QS = "SELECT count(`id`) as `cnt`, `ts`/86400 as `ts` FROM `events` GROUP BY `ts`/86400";
  6. $RR = $ZIZI->Query( $QS );
  7. if( count( $RR ) ){
  8. $DD = array();
  9. foreach( $RR as $R ){
  10. $CC = intval( $R['cnt'] );
  11. if( $CC > 100 ) $CC = 100;
  12. $DD[] = '{"t": '.($R['ts']*86400000).',"v":'.$CC.'}';
  13. //echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
  14. };
  15. echo "[" . implode(",", $DD ) . "]";
  16. } else {
  17. echo "[]";
  18. };
  19. } else {
  20. header('location: /');
  21. };
  22. ?>