本文整理匯總了PHP中DbConnect函數的典型用法代碼示例。如果您正苦於以下問題:PHP DbConnect函數的具體用法?PHP DbConnect怎麽用?PHP DbConnect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DbConnect函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: payment
public function payment($module = '')
{
global $payment, $language, $PHP_SELF;
$instance_sub_table = new Table("cc_payment_methods", "payment_filename");
$DBHandle = DbConnect();
$return = null;
$return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$this->modules = array();
if (is_array($return)) {
foreach ($return as $value) {
array_push($this->modules, $value["payment_filename"]);
}
}
$include_modules = array();
if (!empty($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
$this->selected_module = $module;
$include_modules[] = array('class' => $module, 'file' => $module . '.php');
} else {
reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
$include_modules[] = array('class' => $class, 'file' => $value);
}
}
for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
include dirname(__FILE__) . '/../methods/' . $include_modules[$i]['file'];
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
}
if (!is_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
$this->form_action_url = $GLOBALS[$module]->form_action_url;
}
$actived_module = $this->selection();
$payment = $actived_module[0]['id'];
}
示例2: query
function query($order_amount)
{
global $languages_id;
if (isset($_SESSION["agent_id"]) && !empty($_SESSION["agent_id"])) {
$QUERY = "SELECT login as username, credit, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, '1', currency FROM cc_agent WHERE id = '" . $_SESSION["agent_id"] . "'";
} elseif (isset($_SESSION["card_id"]) && !empty($_SESSION["card_id"])) {
$QUERY = "SELECT username, credit, lastname, firstname, address, city, state, country, zipcode, phone, email, fax, status, currency FROM cc_card WHERE id = '" . $_SESSION["card_id"] . "'";
} else {
echo "ERROR";
die;
}
$DBHandle_max = DbConnect();
$resmax = $DBHandle_max->query($QUERY);
$numrow = $resmax->numRows();
if ($numrow == 0) {
exit;
}
$customer_info = $resmax->fetchRow();
if ($customer_info[12] != "1" && $customer_info[12] != "8") {
exit;
}
$order = $customer_info;
$this->info = array('currency' => isset($A2B->config["paypal"]['currency_code']) ? $A2B->config["paypal"]['currency_code'] : null, 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => '', 'orders_status' => '', 'last_modified' => '', 'total' => strip_tags($order_amount), 'shipping_method' => substr($shipping_method['title'], -1) == ':' ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title']));
$this->customer = array('id' => $order['customers_id'], 'name' => $order['username'], 'company' => '', 'street_address' => $order['address'], 'suburb' => '', 'city' => $order['city'], 'postcode' => $order['zipcode'], 'state' => $order['state'], 'country' => $order['country'], 'format_id' => '', 'telephone' => $order['telephone'], 'email_address' => $order['email']);
$this->delivery = array('name' => $order['username'], 'company' => '', 'street_address' => $order['address'], 'suburb' => '', 'city' => $order['city'], 'postcode' => $order['zipcode'], 'state' => $order['state'], 'country' => $order['country'], 'format_id' => '');
if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
$this->delivery = false;
}
$this->billing = array('firstname' => $order['firstname'], 'lastname' => $order['lastname'], 'name' => $order['firstname'], 'company' => '', 'street_address' => $order['address'], 'suburb' => '', 'city' => $order['city'], 'postcode' => $order['zipcode'], 'state' => $order['state'], 'country' => $order['country'], 'format_id' => '');
}
示例3: user_from_ldap_servers
/**
* ldap by Stephane Garret & vtur
* Check all the directories. When the user is found, then import it
* @param $login : user login
* @param $password : user password
* @param $import : import user or check
**/
function user_from_ldap_servers($login, $password = '', $import = true)
{
global $ldapsrv, $user_dn, $fields;
global $dbhost, $dbuser, $dbpass, $dbname;
// search if user exist in local user DB
$link = DbConnect($dbhost, $dbuser, $dbpass, $dbname);
$query = GenQuery('users', 's', '*', '', '', array('user'), array('='), array($login));
$res = DbQuery($query, $link);
if ($import) {
if (DbNumRows($res) == 0) {
$result = ldapFindDn($login);
if ($result != false) {
return $result;
}
}
return false;
} else {
$result = ldapFindDn($login);
if ($result != false) {
$ds1 = connect_ldap($ldapsrv[0], $ldapsrv[1], $user_dn, $password, 0, 0);
if ($ds1) {
//Authetication OK for user
return true;
} else {
//Authetication Failed for user
return false;
}
}
}
return false;
}
示例4: getSuggestions
function getSuggestions($keyword)
{
DbConnect();
$patterns = array('/\\s+/', '/"+/', '/%+/');
$replace = array('');
$keyword = preg_replace($patterns, $replace, $keyword);
if ($keyword != '' and preg_match('/^[ _a-zà-ÿA-ZÀ-ß0-9]*$/i', $keyword)) {
$keyword = mysql_escape_string($keyword);
$query = "SELECT name FROM game_items_factsheet WHERE name LIKE '" . $keyword . "%' ORDER BY BINARY name";
} else {
$query = "SELECT name FROM game_items_factsheet WHERE name=''";
}
$result = myquery($query);
$output = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
$output .= '<response>';
if ($result != false) {
if (mysql_num_rows($result)) {
while ($row = mysql_fetch_array($result)) {
$output .= '<name>' . iconv("Windows-1251", "UTF-8//IGNORE", $row['name']) . '</name>';
}
}
}
$output .= '</response>';
mysql_close();
return $output;
}
示例5: profile_main
function profile_main()
{
global $template;
// open template
$template->setFile('profile.tmpl');
// connect to login db
if (!($db_login = DbConnect(Config::DB_LOGIN_HOST, Config::DB_LOGIN_USER, Config::DB_LOGIN_PWD, Config::DB_LOGIN_NAME))) {
$template->throwError('Datenbankverbindungsfehler. Bitte wende dich an einen Administrator.');
return;
}
$action = Request::getVar('action', '');
switch ($action) {
/****************************************************************************************************
*
* Profil aktualisieren
*
****************************************************************************************************/
case 'change':
// proccess form data
$message = profile_update($db_login);
// update player's data
page_refreshUserData();
break;
/****************************************************************************************************
*
* Account "löschen"
*
****************************************************************************************************/
/****************************************************************************************************
*
* Account "löschen"
*
****************************************************************************************************/
case 'delete':
if (Request::isPost('postConfirm')) {
if (profile_processDeleteAccount($db_login, $_SESSION['player']->playerID)) {
session_destroy();
die(json_encode(array('mode' => 'finish', 'title' => 'Account gelöscht', 'msg' => _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'))));
} else {
$message = array('type' => 'error', 'message' => _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
}
} else {
$template->addVars(array('cancelOrder_box' => true, 'confirm_action' => 'delete', 'confirm_id' => $_SESSION['player']->playerID, 'confirm_mode' => USER_PROFILE, 'confirm_msg' => _('Möchtest du deinen Account wirklich löschen?')));
}
break;
}
// get login data
$playerData = profile_getPlayerData($db_login);
if (!$playerData) {
$template->throwError('Datenbankfehler. Bitte wende dich an einen Administrator');
return;
}
/****************************************************************************************************
*
* Übergeben ans Template
*
****************************************************************************************************/
$template->addVars(array('status_msg' => isset($message) && !empty($message) ? $message : '', 'player' => $playerData['game'], 'language' => LanguageNames::getLanguageNames(), 'template' => Config::$template_paths));
}
示例6: Service_Create_TrunkConfig
function Service_Create_TrunkConfig($activation_code)
{
$DBHandle = DbConnect();
$table_instance = new Table();
if (!$DBHandle) {
write_log(LOGFILE_API_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . " ERROR CONNECT DB");
return array('500', ' ERROR - CONNECT DB ');
}
list($accountnumber, $password) = preg_split("{_}", $activation_code, 2);
$QUERY = "SELECT cc.username, cc.credit, cc.status, cc.id, cc.id_didgroup, cc.tariff, cc.vat, ct.gmtoffset, cc.voicemail_permitted, " . "cc.voicemail_activated, cc_card_group.users_perms, cc.currency " . "FROM cc_card cc LEFT JOIN cc_timezone AS ct ON ct.id = cc.id_timezone LEFT JOIN cc_card_group ON cc_card_group.id=cc.id_group " . "WHERE cc.username = '" . $accountnumber . "' AND cc.uipass = '" . $password . "'";
$res = $DBHandle->Execute($QUERY);
if (!$res) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$row[] = $res->fetchRow();
$card_id = $row[0][3];
if (!$card_id || $card_id < 0) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$QUERY_IAX = "SELECT iax.id, iax.username, iax.secret, iax.disallow, iax.allow, iax.type, iax.host, iax.context FROM cc_iax_buddies iax WHERE iax.id_cc_card = {$card_id}";
$QUERY_SIP = "SELECT sip.id, sip.username, sip.secret, sip.disallow, sip.allow, sip.type, sip.host, sip.context FROM cc_sip_buddies sip WHERE sip.id_cc_card = {$card_id}";
$iax_data = $table_instance->SQLExec($DBHandle, $QUERY_IAX);
$sip_data = $table_instance->SQLExec($DBHandle, $QUERY_SIP);
//Additonal parameters
$additional_sip = explode("|", SIP_ADDITIONAL_PARAMETERS);
$additional_iax = explode("|", IAX_ADDITIONAL_PARAMETERS);
// SIP
$Config_output = "#PROTOCOL:SIP#\n#SIP-TRUNK-CONFIG-START#\n[trunkname]\n";
$Config_output .= "username=" . $sip_data[0][1] . "\n";
$Config_output .= "type=friend\n";
$Config_output .= "secret=" . $sip_data[0][2] . "\n";
$Config_output .= "host=" . $sip_data[0][6] . "\n";
$Config_output .= "context=" . $sip_data[0][7] . "\n";
$Config_output .= "disallow=all\n";
$Config_output .= "allow=" . SIP_IAX_INFO_ALLOWCODEC . "\n";
if (count($additional_sip) > 0) {
for ($i = 0; $i < count($additional_sip); $i++) {
$Config_output .= trim($additional_sip[$i]) . chr(10);
}
}
$Config_output .= "#SIP-TRUNK-CONFIG-END#\n\n";
// IAX
$Config_output .= "#PROTOCOL:IAX#\n#IAX-TRUNK-CONFIG-START#\n[trunkname]\n";
$Config_output .= "username=" . $iax_data[0][1] . "\n";
$Config_output .= "type=friend\n";
$Config_output .= "secret=" . $iax_data[0][2] . "\n";
$Config_output .= "host=" . $iax_data[0][6] . "\n";
$Config_output .= "context=" . $iax_data[0][7] . "\n";
$Config_output .= "disallow=all\n";
$Config_output .= "allow=" . SIP_IAX_INFO_ALLOWCODEC . "\n";
if (count($additional_iax) > 0) {
for ($i = 0; $i < count($additional_iax); $i++) {
$Config_output .= trim($additional_iax[$i]) . chr(10);
}
}
$Config_output .= "#IAX-TRUNK-CONFIG-END#\n\n";
return array($Config_output, '200 -- Config OK');
}
示例7: Service_Get_Rates
function Service_Get_Rates($activation_code)
{
$DBHandle = DbConnect();
$table_instance = new Table();
if (!$DBHandle) {
write_log(LOGFILE_API_CALLBACK, basename(__FILE__).' line:'.__LINE__." ERROR CONNECT DB");
return array('500', ' ERROR - CONNECT DB ');
}
list($accountnumber, $password) = (preg_split("{_}",$activation_code,2));
$QUERY = "SELECT cc.username, cc.credit, cc.status, cc.id, cc.id_didgroup, cc.tariff, cc.vat, ct.gmtoffset, cc.voicemail_permitted, " .
"cc.voicemail_activated, cc_card_group.users_perms, cc.currency " .
"FROM cc_card cc LEFT JOIN cc_timezone AS ct ON ct.id = cc.id_timezone LEFT JOIN cc_card_group ON cc_card_group.id=cc.id_group " .
"WHERE cc.username = '".$accountnumber."' AND cc.uipass = '".$password."'";
$res = $DBHandle -> Execute($QUERY);
if (!$res) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$row [] = $res -> fetchRow();
$card_id = $row[0][3];
if (!$card_id || $card_id < 0) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$QUERY = "SELECT SQL_CALC_FOUND_ROWS dialprefix, destination, MIN(rateinitial) as rateinitial FROM cc_callplan_lcr WHERE tariffgroup_id = '220' ".
"GROUP BY dialprefix ORDER BY destination ASC LIMIT 0,50000";
$res = $DBHandle -> Execute($QUERY);
$num = 0;
if ($res)
$num = $res->RecordCount();
if (!$num) {
return array('400', ' ERROR - NO RATES FOUND');
}
$rates = '';
$arr_rates = array();
for ($i = 0; $i < $num; $i++) {
$arr_rates[$i] = $res->fetchRow();
$rates .= '"'.$arr_rates[$i]['destination'].'","'.$arr_rates[$i]['dialprefix'].'","'.$arr_rates[$i]['rateinitial']."\"\n";
}
return array($rates, '200 -- Rates OK');
}
示例8: ModifyQueryResult
function ModifyQueryResult($SqlText)
{
$Connect = DbConnect();
if (!$Connect) {
SetError('Ошибка при установке соединения к базе данных');
return null;
}
$QueryHandler = mysql_query($SqlText);
if (!$QueryHandler) {
SetError('Ошибка при выполнении запроса');
return null;
}
//mysql_close($Connect);
return mysql_affected_rows();
}
示例9: profile_main
/**
* This function delegates the task at issue to the respective function.
*/
function profile_main()
{
global $template;
// connect to login db
if (!($db_login = DbConnect(Config::DB_LOGIN_HOST, Config::DB_LOGIN_USER, Config::DB_LOGIN_PWD, Config::DB_LOGIN_NAME))) {
$template->throwError('Datenbankverbindungsfehler. Bitte wende dich an einen Administrator.');
return;
}
$action = Request::getVar('action', '');
switch ($action) {
// change cave page
case 'change':
// proccess form data
$message = profile_update($db_login);
// update player's data
page_refreshUserData();
break;
// change cave page
// change cave page
case 'delete':
if (Request::isPost('cancelOrderConfirm')) {
if (profile_processDeleteAccount($db_login, $_SESSION['player']->playerID)) {
session_destroy();
$message = array('type' => 'success', 'message' => _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'));
} else {
$message = array('type' => 'error', 'message' => _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
}
} else {
$template->addVars(array('cancelOrder_box' => true, 'confirm_action' => 'delete', 'confirm_id' => $_SESSION['player']->playerID, 'confirm_mode' => USER_PROFILE, 'confirm_msg' => _('Möchtest du deinen Account wirklich löschen?')));
}
break;
}
// open template
$template->setFile('profile.tmpl');
// get login data
$playerData = profile_getPlayerData($db_login);
if (!$playerData) {
$template->throwError('Datenbankfehler. Bitte wende dich an einen Administrator');
return;
}
// show message
if (isset($message) && !empty($message)) {
$template->addVar('status_msg', $message);
}
// show the profile's data
profile_fillUserData($template, $playerData);
}
示例10: payment
function payment($module = '')
{
global $payment, $language, $PHP_SELF;
$instance_sub_table = new Table("cc_payment_methods", "payment_filename");
$QUERY = " active = 't'";
$DBHandle = DbConnect();
$return = null;
$return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$this->modules = array();
if (is_array($return)) {
foreach ($return as $value) {
array_push($this->modules, $value["payment_filename"]);
}
}
//if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
//$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
$include_modules = array();
if (!is_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
$this->selected_module = $module;
$include_modules[] = array('class' => $module, 'file' => $module . '.php');
} else {
reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
$include_modules[] = array('class' => $class, 'file' => $value);
}
}
for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
include dirname(__FILE__) . '/../methods/' . $include_modules[$i]['file'];
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
}
// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
// $_POST['payment'] value which will be empty (no radio button selection possible)
if (count($this->modules) == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
$payment = $include_modules[0]['class'];
}
if (!is_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
$this->form_action_url = $GLOBALS[$module]->form_action_url;
}
//}
}
示例11: SOAP_A2Billing
public function SOAP_A2Billing()
{
$this->instance_table = new Table();
$this->DBHandle = DbConnect();
// Define the signature of the dispatch map on the Web servicesmethod
// Necessary for WSDL creation
$this->__dispatch_map['Update_Currencies_list'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Reload_Asterisk_SIP_IAX'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Authenticate_Admin'] = array('in' => array('security_key' => 'string', 'username' => 'string', 'pwd' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Set_AdminPwd'] = array('in' => array('security_key' => 'string', 'username' => 'string', 'pwd' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Write_Notification'] = array('in' => array('security_key' => 'string', 'from' => 'string', 'subject' => 'string', 'priority' => 'integer'), 'out' => array('result' => 'string', 'message' => 'string'));
$this->__dispatch_map['Create_Instance'] = array('in' => array('security_key' => 'string', 'instance_name' => 'string'), 'out' => array('result' => 'string', 'message' => 'string'));
$this->__dispatch_map['Set_InstanceDescription'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'description' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Set_InstanceProvisioning'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'provisioning' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Get_CustomerGroups'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Currencies'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Currencies_value'] = array('in' => array('security_key' => 'string', 'currency' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Countries'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Setting'] = array('in' => array('security_key' => 'string', 'setting_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Set_Setting'] = array('in' => array('security_key' => 'string', 'setting_key' => 'string', 'value' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Account_Attribute'] = array('in' => array('security_key' => 'string', 'attribute' => 'string', 'username' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Set_Account_Attribute'] = array('in' => array('security_key' => 'string', 'attribute' => 'string', 'username' => 'string', 'value' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Languages'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Create_DIDGroup'] = array('in' => array('security_key' => 'string', 'instance' => 'string'), 'out' => array('id_didgroup' => 'integer', 'message' => 'string'));
$this->__dispatch_map['Create_Provider'] = array('in' => array('security_key' => 'string', 'instance' => 'string'), 'out' => array('id_provider' => 'integer', 'message' => 'string'));
$this->__dispatch_map['Create_Ratecard'] = array('in' => array('security_key' => 'string', 'instance' => 'string'), 'out' => array('id_ratecard' => 'integer', 'message' => 'string'));
$this->__dispatch_map['Create_Callplan'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'id_ratecard' => 'integer'), 'out' => array('id_callplan' => 'integer', 'message' => 'string'));
$this->__dispatch_map['Create_Voucher'] = array('in' => array('security_key' => 'string', 'credit' => 'float', 'units' => 'integer', 'currency' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Create_Customer'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'id_callplan' => 'integer', 'id_didgroup' => 'integer', 'units' => 'integer', 'accountnumber_len' => 'integer', 'balance' => 'float', 'activated' => 'boolean', 'status' => 'integer', 'simultaccess' => 'integer', 'currency' => 'string', 'typepaid' => 'integer', 'sip' => 'integer', 'iax' => 'integer', 'language' => 'string', 'voicemail_enabled' => 'boolean', 'country' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Validate_DIDPrefix'] = array('in' => array('security_key' => 'string', 'did_prefix' => 'string'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Create_DID'] = array('in' => array('security_key' => 'string', 'account_id' => 'array', 'id_didgroup' => 'integer', 'rate' => 'float', 'connection_charge' => 'float', 'did_prefix' => 'string', 'did_suffix' => 'string', 'country' => 'integer'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_ProvisioningList'] = array('in' => array('security_key' => 'string', 'provisioning_uri' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Create_TrunkConfig'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'uri_trunk' => 'string', 'activation_code' => 'string', 'provider_name' => 'string'), 'out' => array('result' => 'string', 'message' => 'string'));
$this->__dispatch_map['Get_Rates'] = array('in' => array('security_key' => 'string', 'uri_rate' => 'string', 'activation_code' => 'string', 'margin' => 'float'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Create_Rates'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'rates' => 'array'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Update_Rates'] = array('in' => array('security_key' => 'string', 'instance' => 'string', 'rates' => 'array'), 'out' => array('result' => 'boolean', 'message' => 'string'));
$this->__dispatch_map['Get_Subscription_Signup'] = array('in' => array('security_key' => 'string'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Add_CallerID'] = array('in' => array('security_key' => 'string', 'callerid' => 'integer', 'id_cc_card' => 'integer', 'accountnumber' => 'integer'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Calls_History'] = array('in' => array('security_key' => 'string', 'card_id' => 'integer', 'starttime_begin' => 'string', 'starttime_end' => 'string', 'offset' => 'integer', 'items_number' => 'integer', 'terminatecauseid' => 'integer'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Get_Log_Refill'] = array('in' => array('security_key' => 'string', 'card_id' => 'integer', 'offset' => 'integer', 'items_number' => 'integer'), 'out' => array('result' => 'array', 'message' => 'string'));
$this->__dispatch_map['Add_Credit'] = array('in' => array('security_key' => 'string', 'card_id' => 'integer', 'value' => 'string', 'description' => 'string', 'refill_type' => 'integer'), 'out' => array('result' => 'boolean', 'message' => 'string'));
}
示例12: Service_Get_Balance
function Service_Get_Balance($accountnumber, $password)
{
$DBHandle = DbConnect();
$table_instance = new Table();
if (!$DBHandle) {
write_log(LOGFILE_API_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . " ERROR CONNECT DB");
return array('500', ' ERROR - CONNECT DB ');
}
$QUERY = "SELECT cc.username, cc.credit, cc.status, cc.id, cc.currency " . "FROM cc_card cc " . "WHERE cc.username = '" . $accountnumber . "' AND cc.uipass = '" . $password . "'";
$res = $DBHandle->Execute($QUERY);
if (!$res) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$row[] = $res->fetchRow();
$card_id = $row[0][3];
if (!$card_id || $card_id < 0) {
return array('400', ' ERROR - AUTHENTICATE CODE');
}
$balance = $row[0][1];
return array($balance, '200 -- Rates OK');
}
示例13: page_start
function page_start()
{
global $db;
// start stopwatch
stopwatch('start');
// check for cookie
if (!sizeof($_COOKIE)) {
page_finish('cookie');
}
// start session
session_start();
// check for valid session
if (!isset($_SESSION['player']) || !$_SESSION['player']->playerID) {
page_finish('inaktiv');
}
// connect to database
if (!($db = DbConnect())) {
page_finish('db');
}
// init I18n
$_SESSION['player']->init_i18n();
}
示例14: page_start
function page_start()
{
global $db;
// start stopwatch
stopwatch('start');
// check for cookie
if (!sizeof($_COOKIE)) {
page_error403('Sie müssen 3rd party cookies erlauben.');
}
// start session
session_start();
// check for valid session
if (!isset($_SESSION['player']) || !$_SESSION['player']->playerID) {
header("Location: " . Config::GAME_END_URL . "?id=inaktiv");
exit;
}
// connect to database
if (!($db = DbConnect())) {
header("Location: " . Config::GAME_END_URL . "?id=db");
exit;
}
// init I18n
$_SESSION['player']->init_i18n();
}
示例15: 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));
}
//.........這裏部分代碼省略.........