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.
42 lines
1.1 KiB
42 lines
1.1 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
|
|
if( $CUser->Data['id'] > 1 ){
|
|
$Data['success'] = false;
|
|
if( $CUser->Data['access'] > 5 ){
|
|
$NL = trim( $_POST['PNAM'] );
|
|
$NN = str_ireplace('+','',
|
|
str_ireplace('-','',
|
|
str_ireplace( ' ', '', $_POST['PNUM']
|
|
)
|
|
)
|
|
);
|
|
$CO = intval( $_POST['PCAL'] );
|
|
if( $CO == 0 ){
|
|
$CMS = $DATABASE->escape( $_POST['PMSG'] );
|
|
};
|
|
if( strlen( $NN ) > 7 ) {
|
|
if( substr( $NN, 1 ) == '0' ){
|
|
} else {
|
|
};
|
|
if( strlen( $NL ) == 0 ){
|
|
$NL = 'New Number';
|
|
};
|
|
if( $CO ){
|
|
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`) VALUES('{$NN}',1,'{$NL}')";
|
|
} else {
|
|
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')";
|
|
};
|
|
$DATABASE->Query( $QS );
|
|
$Data['success'] = true;
|
|
} else {
|
|
$Data['msg'] = 'Number is Invalid!';
|
|
};
|
|
} else {
|
|
$Data['msg'] = 'Access Denied!';
|
|
};
|
|
echo json_encode( $Data );
|
|
exit();
|
|
};
|
|
header( 'location: /');
|
|
?>
|