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.
 
 
 
 

50 lines
1.3 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data['success'] = false;
if( $CUser->Data['access'] > 5 ){
$OPID = intval( $_POST['OPID'] );
switch( $OPID ){
case 1:{
$NL = trim( $_POST['PNAM'] );
$NN = str_ireplace('+','',
str_ireplace('-','',
str_ireplace( ' ', '', $_POST['PNUM']
)
)
);
$CO = intval( $_POST['PCAL'] );
$CMS = $DATABASE->escape( $_POST['PMSG'] );
if( strlen( $NN ) > 7 ) {
if( substr( $NN, 1 ) == '0' ){
} else {
};
if( strlen( $NL ) == 0 ){
$NL = 'New Number';
};
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`mode`,`label`) VALUES('{$NN}',{$CO},'{$NL}')";
$DATABASE->Query( $QS );
$Data['success'] = true;
} else {
$Data['msg'] = 'Number is Invalid!';
};
break;
};
case 2:{
$PBID = intval( $_POST['PBID'] );
if( $PBID ){
$QS = "DELETE FROM`module_modem_phonebook` WHERE `id`={$PBID}";
$DATABASE->Query( $QS );
$Data['success'] = true;
} else $Data['msg'] = 'Access Denied!';
};
}
} else {
$Data['msg'] = 'Access Denied!';
};
echo json_encode( $Data );
exit();
};
header( 'location: /');
?>