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.
 
 
 
 

46 lines
1.6 KiB

<?php
require_once('../ajax_asm.php');
$UID = intval($CUser->Data['id'] );
$ACCESS = intval($CUser->Data['access'] );
if( $UID > 1 && $ACCESS > 4 ){
$Z = $_POST['NID'];
if( $Z != '' ){
$TArr = explode( ':', $Z );
$NodeID = intval( $TArr[0] );
$QS = "SELECT * FROM nodes WHERE id={$NodeID}";
$result = $DATABASE->Query( $QS, false );
if( count( $result ) ){
$T = $result[0];
$AID = intval( $T['aux_id'] );
$QS = "SELECT `profile_id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} ORDER BY `profile_id`";
$result = $DATABASE->Query( $QS, false );
if( count($result) ) {
$LP = 0;
foreach( $result as $R ){
$LP=intval($R['profile_id']);
};
if( $LP < 3 ){
$LP++;
$QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`={$LP}";
$DATABASE->Query( $QS );
if( $T['type'] == 1 || $T['type'] == 5 ){
$QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`={$LP}";
$DATABASE->Query( $QS );
};
};
} else {
$QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=1, `profile_id`=0";
$DATABASE->Query( $QS );
if( $T['type'] == 1 || $T['type'] == 5 ){
$QS="INSERT INTO `lrf_detection_profiles` SET `aux_id`={$AID}, `master`=0, `profile_id`=0";
$DATABASE->Query( $QS );
};
};
$QS="INSERT INTO `access_log` SET ts=NOW(), `user_id`={$UID}, `cmd`=12, `dataset`='{}'";
$DATABASE->Query( $QS );
};
exit();
};
};
header('location: /');
?>