本文整理汇总了PHP中MDP_NUMERIC函数的典型用法代码示例。如果您正苦于以下问题:PHP MDP_NUMERIC函数的具体用法?PHP MDP_NUMERIC怎么用?PHP MDP_NUMERIC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MDP_NUMERIC函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Request
function Request($security_key, $called, $calling, $callerid, $callback_time, $uniqueid)
{
global $A2B;
/*
$status = 'PENDING';
$server_ip = 'localhost';
$num_attempt = 0;
$channel = 'SIP/'.$phone_number.'@mylittleIP';
$exten = $phone_number;
$context = 'a2billing';
$priority = 1;
//$timeout callerid
$variable = "phonenumber=$phone_number|callerid=$callerid";
*/
$phone_number = $called;
$insert_id_callback = 'null';
if (strlen($uniqueid) == 0) {
$uniqueid = MDP_STRING(5) . '-' . MDP_NUMERIC(10);
}
$FG_regular[] = array("^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})\$", "(YYYY-MM-DD HH:MM:SS)");
// The wrapper variables for security
// $security_key = API_SECURITY_KEY;
write_log(LOG_CALLBACK, " Service_Callback( security_key={$security_key}, called={$called}, calling={$calling}, callerid={$callerid}, uniqueid={$uniqueid}, callback_time={$callback_time})");
$mysecurity_key = API_SECURITY_KEY;
// CHECK CALLERID
if (strlen($callerid) < 1) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT CALLERID AT LEAST 1 DIGIT ");
sleep(2);
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT CALLERID AT LEAST 1 DIGIT ");
}
// CHECK PHONE_NUMBER
if (strlen($phone_number) < 10) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT PHONENUMBER AT LEAST 10 DIGITS ");
sleep(2);
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT PHONENUMBER AT LEAST 10 DIGITS ");
}
// CHECK CALLBACK TIME
if (strlen($callback_time) > 1 && !ereg($FG_regular[0][0], $callback_time)) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT CALLBACKTIME : " . $FG_regular[0][0]);
sleep(2);
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT CALLBACKTIME : " . $FG_regular[0][0]);
}
// CHECK SECURITY KEY
if (md5($mysecurity_key) !== $security_key || strlen($security_key) == 0) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " CODE_ERROR SECURITY_KEY");
sleep(2);
return array($insert_id_callback, 'result=Error', ' KEY - BAD PARAMETER ');
}
$DBHandle = DbConnect();
if (!$DBHandle) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR CONNECT DB");
sleep(2);
return array($insert_id_callback, 'result=Error', ' ERROR - CONNECT DB ');
}
$A2B->DBHandle = $DBHandle;
$instance_table = new Table();
$A2B->set_instance_table($instance_table);
$called = ereg_replace("^\\+", "011", $called);
$calling = ereg_replace("^\\+", "011", $calling);
$called = ereg_replace("[^0-9]", "", $called);
$calling = ereg_replace("[^0-9]", "", $calling);
$called = ereg_replace("^01100", "011", $called);
$calling = ereg_replace("^01100", "011", $calling);
$called = ereg_replace("^00", "011", $called);
$calling = ereg_replace("^00", "011", $calling);
$called = ereg_replace("^0111", "1", $called);
$calling = ereg_replace("^0111", "1", $calling);
$A2B->credit = 1000;
$A2B->tariff = $A2B->config["callback"]['all_callback_tariff'];
$RateEngine = new RateEngine();
// $RateEngine -> webui = 0;
// LOOKUP RATE : FIND A RATE FOR THIS DESTINATION
$A2B->dnid = $A2B->destination = $caller_areacode . $calling;
$resfindrate = $RateEngine->rate_engine_findrates($A2B, $A2B->destination, $A2B->tariff);
// IF FIND RATE
if ($resfindrate != 0) {
//$RateEngine -> debug_st = 1;
$res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit);
if ($res_all_calcultimeout) {
// MAKE THE CALL
if ($RateEngine->ratecard_obj[0][34] != '-1') {
$usetrunk = 34;
$usetrunk_failover = 1;
$RateEngine->usedtrunk = $RateEngine->ratecard_obj[$k][34];
} else {
$usetrunk = 29;
$RateEngine->usedtrunk = $RateEngine->ratecard_obj[$k][29];
$usetrunk_failover = 0;
}
$prefix = $RateEngine->ratecard_obj[0][$usetrunk + 1];
$tech = $RateEngine->ratecard_obj[0][$usetrunk + 2];
$ipaddress = $RateEngine->ratecard_obj[0][$usetrunk + 3];
$removeprefix = $RateEngine->ratecard_obj[0][$usetrunk + 4];
$timeout = $RateEngine->ratecard_obj[0]['timeout'];
$failover_trunk = $RateEngine->ratecard_obj[0][40 + $usetrunk_failover];
$addparameter = $RateEngine->ratecard_obj[0][42 + $usetrunk_failover];
$destination = $A2B->destination;
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0) {
$destination = substr($destination, strlen($removeprefix));
}
//.........这里部分代码省略.........
示例2: Header
Header("Location: " . $HD_Form->FG_GO_LINK_AFTER_ACTION);
exit;
}
$form_action = "add";
$_POST['accountcode'] = $_POST['username'] = $_POST['name'] = $_POST['cardnumber'] = $cardnumber;
$_POST['allow'] = FRIEND_ALLOW;
$_POST['context'] = FRIEND_CONTEXT;
$_POST['nat'] = FRIEND_NAT;
$_POST['amaflags'] = FRIEND_AMAFLAGS;
$_POST['regexten'] = $cardnumber;
$_POST['id_cc_card'] = $id_cc_card;
$_POST['callerid'] = $useralias;
$_POST['qualify'] = FRIEND_QUALIFY;
$_POST['host'] = FRIEND_HOST;
$_POST['dtmfmode'] = FRIEND_DTMFMODE;
$_POST['secret'] = MDP_NUMERIC(5) . MDP_STRING(10) . MDP_NUMERIC(5);
// for the getProcessed var
$HD_Form->_vars = array_merge((array) $_GET, (array) $_POST);
}
$HD_Form->FG_EDITION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?form_action=ask-edit&atmenu={$atmenu}&id=";
$HD_Form->FG_DELETION_LINK = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL) . "?form_action=ask-delete&atmenu={$atmenu}&id=";
if ($id != "" || !is_null($id)) {
$HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "{$id}", $HD_Form->FG_EDITION_CLAUSE);
}
if (!isset($form_action)) {
$form_action = "list";
}
//ask-add
if (!isset($action)) {
$action = $form_action;
}
示例3: is_numeric
if (isset($iax) && $iax == 1) {
$iax_buddy = 1;
}
$creditlimit = is_numeric($creditlimit) ? $creditlimit : 0;
//initialize refill parameter
$description_refill = gettext("CREATION CARD REFILL");
$field_insert_refill = " credit,card_id, description";
$instance_refill_table = new Table("cc_logrefill", $field_insert_refill);
for ($k = 0; $k < $nbcard; $k++) {
$arr_card_alias = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list);
$accountnumber = $arr_card_alias[0];
$useralias = $arr_card_alias[1];
if (!is_numeric($addcredit)) {
$addcredit = 0;
}
$passui_secret = MDP_NUMERIC(5) . MDP_STRING(10) . MDP_NUMERIC(5);
$FG_ADITION_SECOND_ADD_VALUE = "'{$accountnumber}', '{$useralias}', '{$addcredit}', '{$choose_tariff}', 't', '{$gen_id}', '', '', '', '', '', '{$id_country}', '', '', {$choose_simultaccess}, '{$choose_currency}', " . "{$choose_typepaid}, {$creditlimit}, {$enableexpire}, '{$expirationdate}', {$expiredays}, '{$passui_secret}', '{$runservice}', '{$tag}', '{$id_group}', '{$discount}', '{$id_seria}', " . "'{$id_didgroup}', {$sip_buddy}, {$iax_buddy}, '{$vat}'";
if (DB_TYPE != "postgres") {
$FG_ADITION_SECOND_ADD_VALUE .= ", now() ";
}
$id_cc_card = $instance_sub_table->Add_table($HD_Form->DBHandle, $FG_ADITION_SECOND_ADD_VALUE, null, null, $HD_Form->FG_TABLE_ID);
//create refill for each cards
if ($addcredit > 0) {
$value_insert_refill = "'{$addcredit}', '{$id_cc_card}', '{$description_refill}' ";
$instance_refill_table->Add_table($HD_Form->DBHandle, $value_insert_refill, null, null);
}
$instance_realtime->insert_voip_config($sip, $iax, $id_cc_card, $accountnumber, $passui_secret);
}
// Save Sip accounts to file
if (isset($sip)) {
$instance_realtime->create_trunk_config_file('sip');
示例4: time
$gen_id = time();
$_SESSION["IDfilter"]=$gen_id;
$creditlimit = is_numeric($creditlimit) ? $creditlimit : 0;
$sub_credit_amount = 0;
//initialize refill parameter
$description_refill = gettext("CREATION CARD REFILL");
$field_insert_refill = " credit,card_id, description";
$instance_refill_table = new Table("cc_logrefill", $field_insert_refill);
for ($k=0;$k<$nbcard;$k++) {
$arr_card_alias = gen_card_with_alias("cc_card", 0, $cardnumberlenght_list);
$cardnum = $arr_card_alias[0];
$useralias = $arr_card_alias[1];
$addcredit=$initial_credit;
$passui_secret = MDP_NUMERIC(10);
$FG_ADITION_SECOND_ADD_VALUE = "'$cardnum', '$useralias', '$addcredit', '$choose_tariff', 't', '$gen_id', '', '', '', '', '', '', '', '', $choose_simultaccess, '$choose_currency', $choose_typepaid, $creditlimit, $enableexpire, '$expirationdate', $expiredays, '$passui_secret', '$runservice', '$tag', '$id_group', '$discount', '$id_seria'";
if (DB_TYPE != "postgres") $FG_ADITION_SECOND_ADD_VALUE .= ",now() ";
if (isset($sip)) $FG_ADITION_SECOND_ADD_VALUE .= ", 1";
if (isset($iax)) $FG_ADITION_SECOND_ADD_VALUE .= ", 1";
$id_cc_card = $instance_sub_table -> Add_table ($HD_Form -> DBHandle, $FG_ADITION_SECOND_ADD_VALUE, null, null, $HD_Form -> FG_TABLE_ID);
//create refill for each cards
if($addcredit>0){
$value_insert_refill = "'$addcredit', '$id_cc_card', '$description_refill' ";
$instance_refill_table -> Add_table ($HD_Form -> DBHandle, $value_insert_refill, null, null);
$sub_credit_amount += $addcredit;
}
示例5: RANDOM
//default callerid
$callerid = '111111111';
$cidgroupid = $phone["id_cid_group"];
if ($A2B->config["database"]['dbtype'] == "postgres") {
$QUERY = "SELECT cid FROM cc_outbound_cid_list WHERE activated = 1 AND outbound_cid_group = {$cidgroupid} ORDER BY RANDOM() LIMIT 1";
} else {
$QUERY = "SELECT cid FROM cc_outbound_cid_list WHERE activated = 1 AND outbound_cid_group = {$cidgroupid} ORDER BY RAND() LIMIT 1";
}
$instance_cid_table = new Table();
echo "QUERY CID : " . $QUERY;
$cidresult = $instance_cid_table->SQLExec($A2B->DBHandle, $QUERY);
if (is_array($cidresult) && count($cidresult) > 0) {
$callerid = $cidresult[0][0];
}
$account = $_SESSION["pr_login"];
$uniqueid = MDP_NUMERIC(5) . '-' . MDP_STRING(7);
$status = 'PENDING';
$server_ip = 'localhost';
$num_attempt = 0;
$variable = "CALLED={$destination}|USERNAME={$phone['8']}|USERID={$phone['6']}|CBID={$uniqueid}|PHONENUMBER_ID=" . $phone['cc_phonenumber_id'] . "|CAMPAIGN_ID=" . $phone['cc_campaign_id'];
$res = $instance_table->Add_table($A2B->DBHandle, "'{$uniqueid}', '{$status}', '{$server_ip}', '{$num_attempt}', '{$channel}', '{$exten}', '{$context}', '{$priority}', '{$variable}', '{$id_server_group}', now(), '{$account}', '{$callerid}', '30000'", "uniqueid, status, server_ip, num_attempt, channel, exten, context, priority, variable, id_server_group, callback_time, account, callerid, timeout", "cc_callback_spool", "id");
if (!$res) {
if ($verbose_level >= 1) {
echo "[Cannot insert the callback request in the spool!]";
}
} else {
if ($verbose_level >= 1) {
echo "[Your callback request has been queued correctly!]";
}
if ($action == "update") {
$query = "UPDATE cc_campaign_phonestatus SET id_callback = '{$uniqueid}', lastuse = CURRENT_TIMESTAMP WHERE id_phonenumber ={$phone['0']} AND id_campaign = {$phone['2']} ";
示例6: MDP_STRING
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
**/
include './lib/customer.defines.php';
include './lib/customer.module.access.php';
include './lib/Form/Class.FormHandler.inc.php';
if (!isset($form_action)) {
$form_action = "ask-add";
}
if (!isset($action)) {
$action = $form_action;
}
// PROVISION TEST DATA
if (false) {
$_POST["lastname"] = $_POST["firstname"] = $_POST["address"] = $_POST["city"] = $_POST["state"] = $_POST["country"] = 'SIGN-' . MDP_STRING(5) . '-' . MDP_NUMERIC(3);
$_POST["email"] = MDP_STRING(10) . '@sign-up.com';
$_POST["zipcode"] = $_POST["phone"] = '12345667789';
}
include './form_data/FG_var_signup.inc';
include './lib/customer.smarty.php';
if (!$A2B->config["signup"]['enable_signup']) {
echo "No Signup page!";
exit;
}
getpost_ifset(array('subscriber_signup'));
if (!is_numeric($subscriber_signup)) {
//check subscriber_signup
$table_check_subscriber = new Table("cc_subscription_signup", "COUNT(*)");
$clause_check_subscriber = "";
$result_check_subscriber = $table_check_subscriber->Get_list(DbConnect(), $clause_check_subscriber);
示例7: Create_Customer
function Create_Customer($security_key, $instance, $id_callplan, $id_didgroup, $units, $accountnumber_len, $balance, $activated, $status, $simultaccess, $currency, $typepaid, $sip, $iax, $language, $voicemail_enabled, $country)
{
$arr_check = $this->Check_KeyInstance($security_key, $instance);
if ($arr_check[0] == 'ERROR') {
return $arr_check;
}
$id_group = $arr_check[0];
if (!is_numeric($id_callplan)) {
return array("ERROR", "NO ID_CALLPLAN PROVIDED");
}
if ($accountnumber_len < 2 || $accountnumber_len > 40) {
return array("ERROR", "WRONG ACCOUNT NUMBER LENGTH - $accountnumber_len");
}
if (strlen($country)==3)
$country = strtoupper($country);
else
$country = 'USA';
if (strlen($language)==2)
$language = strtolower($language);
else
$language = 'en';
if ($activated)
$activated = 't';
else
$activated = 'f';
$instance_realtime = new Realtime();
$FG_ADITION_SECOND_ADD_TABLE = "cc_card";
$FG_ADITION_SECOND_ADD_FIELDS = "username, useralias, credit, tariff, country, language, activated, simultaccess, currency, typepaid, uipass, id_group, id_didgroup, sip_buddy, iax_buddy";
if (DB_TYPE != "postgres") {
$FG_ADITION_SECOND_ADD_FIELDS .= ",creationdate ";
}
$instance_sub_table = new Table($FG_ADITION_SECOND_ADD_TABLE, $FG_ADITION_SECOND_ADD_FIELDS);
$sip_buddy = $iax_buddy = 0;
if (isset ($sip) && $sip == 1)
$sip_buddy = 1;
if (isset ($iax) && $iax == 1)
$iax_buddy = 1;
//initialize refill parameter
$description_refill = gettext("CREATION CARD REFILL");
$field_insert_refill = "credit, card_id, description";
$instance_refill_table = new Table("cc_logrefill", $field_insert_refill);
$arr_account = array();
for ($k = 0; $k < $units; $k++) {
$arr_card_alias = gen_card_with_alias("cc_card", 0, $accountnumber_len);
$accountnumber = $arr_card_alias[0];
$useralias = $arr_card_alias[1];
if (!is_numeric($balance))
$balance = 0;
$passui_secret = MDP_NUMERIC(10);
$FG_ADITION_SECOND_ADD_VALUE = "'$accountnumber', '$useralias', '$balance', '$id_callplan', '$country', '$language', '$activated', ".
" $simultaccess, '$currency', $typepaid, '$passui_secret', '$id_group', '$id_didgroup', $sip_buddy, $iax_buddy";
if (DB_TYPE != "postgres")
$FG_ADITION_SECOND_ADD_VALUE .= ", now() ";
$id_cc_card = $instance_sub_table->Add_table($this->DBHandle, $FG_ADITION_SECOND_ADD_VALUE, null, null, 'id');
if (!$id_cc_card) {
return array(false, "ERROR CREATING ACCOUNT (".$k." Accounts created)");
}
$arr_account[] = array ($accountnumber, $id_cc_card);
// create refill for card
if ($balance > 0) {
$value_insert_refill = "'$balance', '$id_cc_card', '$description_refill' ";
$instance_refill_table->Add_table($this->DBHandle, $value_insert_refill, null, null);
}
$instance_realtime -> insert_voip_config ($sip_buddy, $iax_buddy, $id_cc_card, $accountnumber, $passui_secret, $useralias, $language);
}
// Save Sip accounts to file
$instance_realtime -> create_trunk_config_file ('sip');
// Save IAX accounts to file
$instance_realtime -> create_trunk_config_file ('iax');
return array(serialize($arr_account), "Create_Customer SUCCESS - ".$k." ACCOUNTS CREATED");
}
示例8: Header
Header("Location: " . $HD_Form->FG_GO_LINK_AFTER_ACTION);
exit;
}
$form_action = "add";
$_POST['accountcode'] = $_POST['username'] = $_POST['name'] = $_POST['cardnumber'] = $cardnumber;
$_POST['allow'] = FRIEND_ALLOW;
$_POST['context'] = FRIEND_CONTEXT;
$_POST['nat'] = FRIEND_NAT;
$_POST['amaflags'] = FRIEND_AMAFLAGS;
$_POST['regexten'] = $cardnumber;
$_POST['id_cc_card'] = $id_cc_card;
$_POST['callerid'] = $useralias;
$_POST['qualify'] = FRIEND_QUALIFY;
$_POST['host'] = FRIEND_HOST;
$_POST['dtmfmode'] = FRIEND_DTMFMODE;
$_POST['secret'] = MDP_NUMERIC(10);
// for the getProcessed var
$HD_Form->_vars = array_merge($_GET, $_POST);
}
/***********************************************************************************/
$HD_Form->FG_EDITION_LINK = $_SERVER['PHP_SELF'] . "?form_action=ask-edit&atmenu={$atmenu}&id=%#id&";
$HD_Form->FG_DELETION_LINK = $_SERVER['PHP_SELF'] . "?form_action=ask-delete&atmenu={$atmenu}&id=%#id&";
if ($id != "" || !is_null($id)) {
$HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "{$id}", $HD_Form->FG_EDITION_CLAUSE);
}
if (!isset($form_action)) {
$form_action = "list";
}
//ask-add
if (!isset($action)) {
$action = $form_action;
示例9: str_replace
if (strlen($addparameter)>0){
$addparameter = str_replace("%cardnumber%", $A2B->cardnumber, $addparameter);
$addparameter = str_replace("%dialingnumber%", $prefix.$destination, $addparameter);
$dialstr .= $addparameter;
}
$channel= $dialstr;
$exten = $inst_pn_member;
$context = 'a2billing-conference-member';;
$id_server_group = $A2B -> config["callback"]['id_server_group'];
$callerid = $called_party;
$priority = 1;
$timeout = $A2B -> config["callback"]['timeout']*1000;
$application = '';
$account = $A2B -> accountcode;
$uniqueid = $callback_uniqueid.'-'.MDP_NUMERIC(5);
$sep = ($A2B->config['global']['asterisk_version'] == "1_6" || $A2B->config['global']['asterisk_version'] == "1_8")?',':'|';
$variable = "CALLED=$inst_pn_member".$sep."CALLING=$inst_pn_member".$sep."CBID=$callback_uniqueid".$sep."TARIFF=$callback_tariff".$sep.
"LEG=".$A2B -> accountcode.$sep."ACCOUNTCODE=".$A2B -> accountcode.$sep."ROOMNUMBER=".$room_number.$sep."RATECARD=".$RateEngine -> ratecard_obj[0][6];
$status = 'PENDING';
$server_ip = 'localhost';
$num_attempt = 0;
if (is_numeric($A2B -> config["callback"]['sec_wait_before_callback']) && $A2B -> config["callback"]['sec_wait_before_callback']>=1) {
$sec_wait_before_callback = $A2B -> config["callback"]['sec_wait_before_callback'];
} else {
$sec_wait_before_callback = 1;
}
示例10: Table
}
// -----------------------------------
// CREATE CARDS
// -----------------------------------
$instance_callplan = new Table("cc_tariffgroup", "id");
$result_callplan_id = $instance_callplan->Get_list($A2B->DBHandle, null, null, null, null, null, 1000, 1);
$nb_db_callplan = sizeof($result_callplan_id);
for ($i = 0; $i < $nb_customer; $i++) {
if ($verbose > 1) {
echo "CREATE CARD : {$i}\n";
}
$id_callplan = $result_callplan_id[rand(0, $nb_db_callplan)]['id'];
$array_card_generated = gen_card_with_alias("cc_card", 0, 10, $A2B->DBHandle);
$card_number = $array_card_generated[0];
$card_alias = $array_card_generated[1];
$pass = MDP_NUMERIC(5) . MDP_STRING(10) . MDP_NUMERIC(5);
$query = "INSERT INTO cc_card (username, useralias, uipass, id_group, credit, language, tariff, id_didgroup, status, simultaccess, currency, runservice, autorefill, initialbalance, typepaid, enableexpire, expirationdate, expiredays, voicemail_permitted, voicemail_activated, invoiceday, lastname, firstname, country, id_timezone, sip_buddy, iax_buddy, inuse, credit_notification, notify_email ) values" . "('1111', '11111', '1111', '1', '10', 'en', '1', '-1', '-1', '1', 'USD', '0', '0', '0', '0', '0', '2018-09-02 23:21:33', '0', '1', '0', '0', '11111', 'card', 'AFG', '1', '0', '0', '0', '-1', '0'); ";
$instance_table->SQLExec($A2B->DBHandle, $query);
}
$query = "SELECT count(*) FROM cc_card;";
$nb_db_card = $instance_table->SQLExec($A2B->DBHandle, $query, 1);
if ($verbose > 0) {
echo "TOTAL DB CARDS : " . $nb_db_card[0][0] . " <br><br>\n\n";
}
// Get a list of card
$instance_card = new Table("cc_card", "id");
$result_card_id = $instance_card->Get_list($A2B->DBHandle, null, null, null, null, null, 1000, 1);
$nb_db_card = sizeof($result_card_id);
// -----------------------------------
// CALLERID
// -----------------------------------
示例11: MDP
function MDP($chrs = LEN_CARDNUMBER)
{
return MDP_NUMERIC($chrs);
}
示例12: include
<?php
include("../lib/customer.defines.php");
$code = MDP_STRING(6);
$_SESSION["captcha_code"] = $code;
$seed = MDP_NUMERIC(6);
$captcha_gd = 1;
if ($captcha_gd)
{
include('captcha_gd.php');
}
else
{
include('captcha_non_gd.php');
}
$captcha = new captcha();
$captcha->execute($code, $seed);
示例13: Table
// -----------------------------------
// CREATE CARDS
// -----------------------------------
$instance_callplan = new Table("cc_tariffgroup","id");
$result_callplan_id = $instance_callplan-> Get_list($A2B -> DBHandle, null, null, null, null, null, 1000, 1);
$nb_db_callplan = sizeof($result_callplan_id);
for($i=0;$i<$nb_customer;$i++) {
if($verbose > 1)
echo "CREATE CARD : $i\n";
$id_callplan= $result_callplan_id [rand(0,$nb_db_callplan )] ['id'];
$array_card_generated = gen_card_with_alias("cc_card", 0, 10, $A2B -> DBHandle);
$card_number = $array_card_generated[0];
$card_alias = $array_card_generated[1];
$pass = MDP_NUMERIC(10);
$query = "INSERT INTO cc_card (username, useralias, uipass, id_group, credit, language, tariff, id_didgroup, status, simultaccess, currency, runservice, autorefill, initialbalance, typepaid, enableexpire, expirationdate, expiredays, voicemail_permitted, voicemail_activated, invoiceday, lastname, firstname, country, id_timezone, sip_buddy, iax_buddy, inuse, credit_notification, notify_email ) values".
"('1111', '11111', '1111', '1', '10', 'en', '1', '-1', '-1', '1', 'USD', '0', '0', '0', '0', '0', '2018-09-02 23:21:33', '0', '1', '0', '0', '11111', 'card', 'AFG', '1', '0', '0', '0', '-1', '0'); ";
$instance_table -> SQLExec ($A2B -> DBHandle, $query);
}
$query = "SELECT count(*) FROM cc_card;";
$nb_db_card = $instance_table -> SQLExec ($A2B -> DBHandle, $query, 1);
if($verbose > 0) echo "TOTAL DB CARDS : ".$nb_db_card[0][0]." <br><br>\n\n";
// Get a list of card
$instance_card = new Table("cc_card","id");
$result_card_id = $instance_card -> Get_list($A2B -> DBHandle, null, null, null, null, null, 1000, 1);
$nb_db_card = sizeof($result_card_id);
示例14: Request
public function Request($security_key, $called, $calling, $callerid, $callback_time, $uniqueid, $accountnumber)
{
// $called : PHONE NUMBER PERSON CALLING
// $calling : DESTINATION PHONE NUMBER
global $A2B;
/*
$status = 'PENDING';
$server_ip = 'localhost';
$num_attempt = 0;
$channel = 'SIP/'.$phone_number.'@mylittleIP';
$exten = $phone_number;
$context = 'a2billing';
$priority = 1;
//$timeout callerid
$variable = "phonenumber=$phone_number|callerid=$callerid";
*/
$phone_number = $called;
$insert_id_callback = 'null';
if (strlen($uniqueid) == 0) {
$uniqueid = MDP_STRING(5) . '-' . MDP_NUMERIC(5) . MDP_STRING(10) . MDP_NUMERIC(5);
}
$FG_regular[] = array("^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})\$", "(YYYY-MM-DD HH:MM:SS)");
// The wrapper variables for security
// $security_key = API_SECURITY_KEY;
write_log(LOG_CALLBACK, " Service_Callback( security_key={$security_key}, called={$called}, calling={$calling}, callerid={$callerid}, uniqueid={$uniqueid}, callback_time={$callback_time})");
$mysecurity_key = API_SECURITY_KEY;
// CHECK CALLERID
if (strlen($callerid) < 1) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT CALLERID AT LEAST 1 DIGIT ");
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT CALLERID AT LEAST 1 DIGIT ");
}
// CHECK PHONE_NUMBER
if (strlen($phone_number) < 10) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT PHONENUMBER AT LEAST 10 DIGITS ");
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT PHONENUMBER AT LEAST 10 DIGITS ");
}
// CHECK DESTINATION NUMBER
if (strlen($calling) < 2) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT DESTINATION NUMBER AT LEAST 2 DIGITS ");
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT DESTINATION NUMBER AT LEAST 2 DIGITS ");
}
// CHECK CALLBACK TIME
if (strlen($callback_time) > 1 && !preg_match("/" . $FG_regular[0][0] . "/", $callback_time)) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR FORMAT CALLBACKTIME : " . $FG_regular[0][0]);
return array($insert_id_callback, 'result=Error', " ERROR - FORMAT CALLBACKTIME : " . $FG_regular[0][0]);
}
// CHECK SECURITY KEY
if (md5($mysecurity_key) !== $security_key || strlen($security_key) == 0) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " CODE_ERROR SECURITY_KEY");
sleep(2);
return array($insert_id_callback, 'result=Error', ' KEY - BAD PARAMETER ');
}
$DBHandle = DbConnect();
if (!$DBHandle) {
write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR CONNECT DB");
sleep(2);
return array($insert_id_callback, 'result=Error', ' ERROR - CONNECT DB ');
}
$A2B->DBHandle = $DBHandle;
$instance_table = new Table();
$A2B->set_instance_table($instance_table);
$A2B->credit = 1000;
$A2B->tariff = $A2B->config["callback"]['all_callback_tariff'];
if (strlen($accountnumber) > 1) {
// IF WE HAVE AN ACCOUNT NUMBER DEFINED
$QUERY = "SELECT tariff, typepaid, credit, creditlimit FROM cc_card WHERE username='{$accountnumber}'";
$card_data = $instance_table->SQLExec($DBHandle, $QUERY);
if (is_array($card_data)) {
$A2B->credit = $card_data[0]['credit'];
if ($card_data[0]['typepaid'] == 1) {
$A2B->credit = $A2B->credit + $card_data[0]['creditlimit'];
}
$A2B->tariff = $card_data[0]['tariff'];
}
//Else find accountnumber from caller's CallerID
} else {
$QUERY .= "SELECT cc_card.tariff, cc_card.typepaid, cc_card.credit, cc_card.creditlimit, cc_card.username" . " FROM cc_card " . " JOIN cc_callerid" . " ON cc_card.id=cc_callerid.id_cc_card " . " WHERE cc_callerid.cid='" . $phone_number . "'";
$QUERY .= "ORDER BY 1";
$card_data = $instance_table->SQLExec($DBHandle, $QUERY);
if (!is_array($card_data)) {
return array($insert_id_callback, 'result=Error', "CALLING'S PARTY CALLERID DOES NOT EXIST IN DATABASE");
}
$accountnumber = $card_data[0]['username'];
if (is_array($card_data)) {
$A2B->credit = $card_data[0]['credit'];
if ($card_data[0]['typepaid'] == 1) {
$A2B->credit = $A2B->credit + $card_data[0]['creditlimit'];
}
$A2B->tariff = $card_data[0]['tariff'];
}
}
$RateEngine = new RateEngine();
$A2B->extension = $A2B->dnid = $A2B->destination = $called;
// LOOKUP RATE : FIND A RATE FOR THIS DESTINATION
$resfindrate = $RateEngine->rate_engine_findrates($A2B, $A2B->destination, $A2B->tariff);
if ($resfindrate != 0) {
//$RateEngine -> debug_st = 1;
$res_all_calcultimeout = $RateEngine->rate_engine_all_calcultimeout($A2B, $A2B->credit);
if ($res_all_calcultimeout) {
// MAKE THE CALL
//.........这里部分代码省略.........