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.

36 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. $UID = intval( $CUser->Data['id'] );
  4. $ACCESS = intval( $CUser->Data['access'] );
  5. if( $UID > 1 && $ACCESS > 1 ){
  6. $INFO = $_POST['NID'];
  7. if( $INFO != '' ){
  8. $TArr = explode( ':', $INFO );
  9. $NodeID = intval( $TArr[0]);
  10. $NoteID = intval( $TArr[1]);
  11. $METHOD = intval( $_POST['MET'] );
  12. $Data = array();
  13. $QS = "SELECT * FROM nodes WHERE id={$NodeID}";
  14. $result = $DATABASE->Query( $QS );
  15. if( count( $result ) ){
  16. $DevID = intval( $result[0]['aux_id'] );
  17. switch( $METHOD ){
  18. case 1:{
  19. $QS = "UPDATE lrf_sensors SET data_status = 1 WHERE id={$result[0]['aux_id']}";
  20. $DATABASE->Query( $QS );
  21. $QS = "UPDATE notifications SET status='D' WHERE id={$NoteID}";
  22. $DATABASE->Query( $QS );
  23. $QS = "INSERT INTO `access_log` SET `ts`=NOW(), `user_id`={$UID},`cmd`=10, `dataset`='{\"node\":{$NodeID},\"note\":{$NoteID},\"method\":1}'";
  24. $DATABASE->Query( $QS );
  25. break;
  26. };
  27. };
  28. $Data['status'] = 'OK';
  29. } else {
  30. $Data['status'] = 'NONODE';
  31. };
  32. };
  33. } else {
  34. $Data['status']='NOACCESS';
  35. };
  36. echo json_encode( $Data );
  37. ?>