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.

45 lines
1.6 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 > 4 ){
  6. $Z = $_POST['NID'];
  7. if( $Z != '' ){
  8. $TArr = explode( ':', $Z );
  9. $NodeID = intval( $TArr[0] );
  10. $QS = "SELECT * FROM nodes WHERE id={$NodeID}";
  11. $result = $DATABASE->Query( $QS, false );
  12. if( count( $result ) ){
  13. $T = $result[0];
  14. $AID = intval( $T['aux_id'] );
  15. $QS = "SELECT `profile_id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} ORDER BY `profile_id`";
  16. $result = $DATABASE->Query( $QS, false );
  17. if( count($result) ) {
  18. $LP = 0;
  19. foreach( $result as $R ){
  20. $LP=intval($R['profile_id']);
  21. };
  22. if( $LP < 3 ){
  23. $LP++;
  24. $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`={$LP}";
  25. $DATABASE->Query( $QS );
  26. if( $T['type'] == 1 || $T['type'] == 5 ){
  27. $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`={$LP}";
  28. $DATABASE->Query( $QS );
  29. };
  30. };
  31. } else {
  32. $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`=0";
  33. $DATABASE->Query( $QS );
  34. if( $T['type'] == 1 || $T['type'] == 5 ){
  35. $QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`=0";
  36. $DATABASE->Query( $QS );
  37. };
  38. };
  39. $QS="INSERT INTO `access_log` SET ts=NOW(), `user_id`={$UID}, `cmd`=12, `dataset`='{}'";
  40. $DATABASE->Query( $QS );
  41. };
  42. exit();
  43. };
  44. };
  45. header('location: /');
  46. ?>