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.

38 lines
999 B

​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. if( isset( $_POST['NID'] ) ){
  5. $NID = intval( $_POST['NID'] );
  6. if( $NID ){
  7. $QS="SELECT `data` FROM `lrf_draw` WHERE `node_id`={$NID} AND `type`=0 ORDER BY `ts` DESC LIMIT 1";
  8. $SS = $DATABASE->Query( $QS );
  9. $Data['count'] = 0;
  10. if( count( $SS ) ){
  11. $DUDU= $SS[0]['data'];
  12. $FD = fopen( 'data/device_draws/' . $DUDU.'.raw', "r" );
  13. if( $FD ){
  14. $C = fread( $FD, 4 );
  15. if( $C !== false ){
  16. $U = unpack("L", $C );
  17. $Data['count'] = $U[1];
  18. $C = fread( $FD, 4*$Data['count'] );
  19. $U = unpack("S*", $C );
  20. $idx = 1;
  21. $C = array();
  22. $Data['data']=array();
  23. for( $i = 0; $i < $Data['count']; $i++ ){
  24. $C['S'] = $U[$idx++];
  25. $C['M'] = $U[$idx++];
  26. $Data['data'][]=$C;
  27. };
  28. };
  29. fclose( $FD );
  30. };
  31. };
  32. echo json_encode( $Data );
  33. exit();
  34. };
  35. };
  36. };
  37. header('location: /');
  38. ?>