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.

41 lines
1.1 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $Data['success'] = false;
  5. if( $CUser->Data['access'] > 5 ){
  6. $NL = trim( $_POST['PNAM'] );
  7. $NN = str_ireplace('+','',
  8. str_ireplace('-','',
  9. str_ireplace( ' ', '', $_POST['PNUM']
  10. )
  11. )
  12. );
  13. $CO = intval( $_POST['PCAL'] );
  14. if( $CO == 0 ){
  15. $CMS = $DATABASE->escape( $_POST['PMSG'] );
  16. };
  17. if( strlen( $NN ) > 7 ) {
  18. if( substr( $NN, 1 ) == '0' ){
  19. } else {
  20. };
  21. if( strlen( $NL ) == 0 ){
  22. $NL = 'New Number';
  23. };
  24. if( $CO ){
  25. $QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`) VALUES('{$NN}',1,'{$NL}')";
  26. } else {
  27. $QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')";
  28. };
  29. $DATABASE->Query( $QS );
  30. $Data['success'] = true;
  31. } else {
  32. $Data['msg'] = 'Number is Invalid!';
  33. };
  34. } else {
  35. $Data['msg'] = 'Access Denied!';
  36. };
  37. echo json_encode( $Data );
  38. exit();
  39. };
  40. header( 'location: /');
  41. ?>