Пример #1
0
 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
0
 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
0
/**
 * 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
0
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
0
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
0
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 = '******' AND cc.uipass = '******'";
    $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="******"\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="******"\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
0
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 = '******' AND cc.uipass = '******'";
	$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
0
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
0
/**
 * 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
0
 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
0
 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
0
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 = '******' AND cc.uipass = '******'";
    $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
0
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
0
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
0
 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));
             }
             $pos_dialingnumber = strpos($ipaddress, '%dialingnumber%');
             $ipaddress = str_replace("%cardnumber%", $A2B->cardnumber, $ipaddress);
             $ipaddress = str_replace("%dialingnumber%", $prefix . $destination, $ipaddress);
             if ($pos_dialingnumber !== false) {
                 $dialstr = "{$tech}/{$ipaddress}" . $dialparams;
             } else {
                 if ($A2B->agiconfig['switchdialcommand'] == 1) {
                     $dialstr = "{$tech}/{$prefix}{$destination}@{$ipaddress}" . $dialparams;
                 } else {
                     $dialstr = "{$tech}/{$ipaddress}/{$prefix}{$destination}" . $dialparams;
                 }
             }
             //ADDITIONAL PARAMETER 			%dialingnumber%,	%cardnumber%
             if (strlen($addparameter) > 0) {
                 $addparameter = str_replace("%cardnumber%", $A2B->cardnumber, $addparameter);
                 $addparameter = str_replace("%dialingnumber%", $prefix . $destination, $addparameter);
                 $dialstr .= $addparameter;
             }
             $channel = $dialstr;
             $exten = $calling;
             $context = $A2B->config["callback"]['context_callback'];
             $id_server_group = $A2B->config["callback"]['id_server_group'];
             $priority = 1;
             $timeout = $A2B->config["callback"]['timeout'] * 1000;
             $application = '';
             $status = 'PENDING';
             $server_ip = 'localhost';
             $num_attempt = 0;
             $variable = "MODE=CID|CALLED={$called}|CALLING={$calling}|CBID={$uniqueid}|TARIFF=" . $A2B->tariff;
             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;
             }
             // LIST FIELDS TO INSERT CALLBACK REQUEST
             $QUERY_FIELS = 'uniqueid, status, server_ip, num_attempt, channel, exten, context, priority, variable, id_server_group, callback_time, account, callerid, timeout';
             // DEFINE THE CORRECT VALUE FOR THE INSERT
             if (strlen($callback_time) > 1) {
                 $QUERY_VALUES = "'{$uniqueid}', '{$status}', '{$server_ip}', '{$num_attempt}', '{$channel}', '{$exten}', '{$context}', '{$priority}', '{$variable}', '{$id_server_group}', '{$callback_time}', '{$account}', '{$callerid}', '30000'";
             } else {
                 if ($A2B->config["database"]['dbtype'] != "postgres") {
                     // MYSQL
                     $QUERY_VALUES = "'{$uniqueid}', '{$status}', '{$server_ip}', '{$num_attempt}', '{$channel}', '{$exten}', '{$context}', '{$priority}', '{$variable}', '{$id_server_group}', ADDDATE( CURRENT_TIMESTAMP, INTERVAL {$sec_wait_before_callback} SECOND ), '{$account}', '{$callerid}', '30000'";
                 } else {
                     // POSTGRESQL
                     $QUERY_VALUES = "'{$uniqueid}', '{$status}', '{$server_ip}', '{$num_attempt}', '{$channel}', '{$exten}', '{$context}', '{$priority}', '{$variable}', '{$id_server_group}',  (CURRENT_TIMESTAMP + INTERVAL '{$sec_wait_before_callback} SECOND'), '{$account}', '{$callerid}', '30000'";
                 }
             }
             $insert_id_callback = $instance_table->Add_table($DBHandle, $QUERY_VALUES, $QUERY_FIELS, 'cc_callback_spool', 'id');
             if (!$insert_id_callback) {
                 // FAIL INSERT
                 write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR INSERT -> \n QUERY=" . $QUERY);
                 sleep(2);
                 return array($insert_id_callback, 'result=Error', ' ERROR - INSERT INTO DB');
             }
             // SUCCEED INSERT
             write_log(LOG_CALLBACK, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " CALLBACK INSERTED -> \n QUERY=" . $QUERY);
             return array($insert_id_callback, 'result=Success', " Success - Callback request has been accepted ");
         } else {
             $error_msg = 'Error : You don t have enough credit to call you back !!!';
         }
     } else {
         $error_msg = 'Error : There is no route to call back your phonenumber !!!';
     }
     // CALLBACK FAIL
     write_log(LOG_CALLBACK, "error_msg = {$error_msg}");
     return array($insert_id_callback, 'result=Error', " ERROR - {$error_msg}");
 }
Пример #16
0
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */
if ($_SERVER['argc'] != 1) {
    echo "Usage: " . $_SERVER['argv'][0] . "\n";
    exit(1);
}
echo "REPAIR START SCIENCES...\n";
include "util.inc.php";
include INC_DIR . "config.inc.php";
include INC_DIR . "db.inc.php";
include INC_DIR . "formula_parser.inc.php";
$db = DbConnect();
$query = "SELECT * FROM StartValue";
if (!($result = $db->query($query))) {
    echo "Could not get start values.\n";
    exit(1);
}
$allValues = array();
while ($row = $result->nextRow(MYSQL_ASSOC)) {
    $allValues[$row['dbFieldName']] = $row['value'];
}
$scienceSet = array();
foreach ($GLOBALS['scienceTypeList'] as $id => $science) {
    if (($tmp = $allValues[$science->dbFieldName]) > 0) {
        $scienceSet[] = "{$science->dbFieldName} = '{$tmp}'";
    }
}
Пример #17
0
function linktonext_2($value){
        $handle = DbConnect();
        $inst_table = new Table("cc_tariffgroup", "id");
        $FG_TABLE_CLAUSE = "tariffgroupname = '$value'";
        $list_group = $inst_table -> Get_list ($handle, $FG_TABLE_CLAUSE, "", "", "", "", "", "", "", 10);
        $id = $list_group[0][0];
    if($id > 0){
        echo "<a href=\"call-pnl-report.php?group_id=$id&report_type=2\">$value</a>";
    }else{
        echo $value;
    }
}
Пример #18
0
    case 'week':
        define('STATS_TYPE', STATS_WEEK);
        define('STATS_CYCLE', STATS_WEEK_COUNT);
        break;
    case 'day':
        define('STATS_TYPE', STATS_DAY);
        define('STATS_CYCLE', STATS_DAY_COUNT);
        break;
    case 'hour':
    default:
        define('STATS_TYPE', STATS_HOUR);
        define('STATS_CYCLE', STATS_HOUR_COUNT);
        break;
}
echo "RUNNING UNIT STATS...\n";
if (!($db = DbConnect())) {
    echo "GAME UNIT STATS: Failed to connect to game db.\n";
    exit(1);
}
/*
 * get db fields
 */
foreach ($GLOBALS['unitTypeList'] as $value) {
    $UnitFieldsName[$value->dbFieldName] = $value->name;
}
echo "GAME UNIT STATS: Start.\n";
/*
 * get secret player and cace
 */
$sql = $db->prepare("SELECT Cave.caveID " . "FROM " . CAVE_TABLE . " " . "LEFT JOIN " . PLAYER_TABLE . " " . "ON Cave.playerID = Player.playerID " . "WHERE Player.noStatistic = 1 OR Cave.noStatistic = 1");
$SecretCave = array();
Пример #19
0
$HD_Form -> FG_EDITION = false;
$HD_Form -> FG_DELETION = false;
$HD_Form -> FG_OTHER_BUTTON1 = false;
$HD_Form -> FG_OTHER_BUTTON2 = false;
$HD_Form -> FG_FILTER_APPLY = false;
$HD_Form -> FG_LIST_ADDING_BUTTON1 = false;
$HD_Form -> FG_LIST_ADDING_BUTTON2 = false;

getpost_ifset(array('nb_to_create', 'initial_credit', 'creditlimit', 'cardnum', 'choose_tariff', 'gen_id', 'cardnum', 'choose_simultaccess', 
	'choose_currency', 'choose_typepaid', 'creditlimit', 'enableexpire', 'expirationdate', 'expiredays', 'runservice', 'sip', 'iax',
	'cardnumberlenght_list', 'tag', 'id_group', 'discount', 'id_seria'));


//=============================== Get Balance ====================================
$QUERY = "SELECT  credit, currency FROM cc_agent WHERE id = '".$_SESSION['agent_id']."'";
$DBHandle_max = DbConnect();
$numrow = 0;
$resmax = $DBHandle_max -> Execute($QUERY);
if ($resmax)
        $numrow = $resmax -> RecordCount();

if ($numrow == 0) exit();
$agent_info =$resmax -> fetchRow();
if (!isset($currencies_list[strtoupper($agent_info [1])][2]) || !is_numeric($currencies_list[strtoupper($agent_info [1])][2])){
        $mycur = 1;
}else{
        $mycur = $currencies_list[strtoupper($agent_info [1])][2];
}
$credit_cur = $agent_info[0] / $mycur;
$credit_cur = round($credit_cur,3);
//=============================== Get Balance ====================================
Пример #20
0
$customer_info = $resmax->fetchRow();
if ($customer_info[14] != "1" && $customer_info[14] != "8") {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
getpost_ifset(array('posted', 'tariffplan', 'balance', 'id_cc_card', 'called'));
$id_cc_card = $customer_info[15];
$tariffplan = $customer_info[16];
$balance = $customer_info[1];
$FG_DEBUG = 0;
$DBHandle = DbConnect();
if ($called && $id_cc_card) {
    $calling = $called;
    if (strlen($calling) > 2 && is_numeric($calling)) {
        $A2B->DBHandle = DbConnect();
        $instance_table = new Table();
        $A2B->set_instance_table($instance_table);
        $num = 0;
        $result = $A2B->instance_table->SQLExec($A2B->DBHandle, "SELECT username, tariff FROM cc_card where id='{$customer_info['15']}'");
        if (!is_array($result) || count($result) == 0) {
            echo gettext("Error card !!!");
            exit;
        }
        $A2B->cardnumber = $result[0][0];
        $A2B->credit = $balance;
        if ($FG_DEBUG == 1) {
            echo "cardnumber = " . $result[0][0] . " - balance={$balance}<br>";
        }
        if ($A2B->callingcard_ivr_authenticate_light($error_msg)) {
            if ($FG_DEBUG == 1) {
Пример #21
0
**/


include ("../lib/admin.defines.php");
include ("../lib/admin.module.access.php");
include ("../lib/Form/Class.FormHandler.inc.php");
include ("./form_data/FG_var_did_billing.inc");
include ("../lib/admin.smarty.php");

if (!has_rights(ACX_DID)) {
	Header("HTTP/1.0 401 Unauthorized");
	Header("Location: PP_error.php?c=accessdenied");
	die();
}

$HD_Form->setDBHandler(DbConnect());

$HD_Form->init();

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;

$list = $HD_Form->perform_action($form_action);

// #### HEADER SECTION
Пример #22
0
 * the License, or (at your option) any later version.
 */
include "util.inc.php";
include INC_DIR . "config.inc.php";
include INC_DIR . "db.inc.php";
include INC_DIR . "game_rules.php";
include INC_DIR . "time.inc.php";
include INC_DIR . "basic.lib.php";
echo "---------------------------------------------------------------------\n";
echo "- MULTI ROTATE  LOG FILE --------------------------------------------\n";
echo "  vom " . date("r") . "\n";
if (!($db_login = db_connectToLoginDB())) {
    echo "Rotate Multi : Failed to connect to login db.\n";
    exit(1);
}
if (!($db_game = DbConnect())) {
    echo "Rotate Multi : Failed to connect to game db.\n";
    exit(1);
}
//alte multies als gel�scht markieren
$sql = $db_login->prepare("UPDATE Login \n                           SET deleted = 1 \n                           WHERE multi = 66 \n                           AND lastChange < NOW() - INTERVAL 14 DAY");
if (!$sql->execute()) {
    echo "Rotate Multi : Failed to mark old multis deleted.\n";
    exit(1);
}
//multi mit stati 65 in den stati 66 packen und in den stamm multi packen
$sql = $db_login->prepare("SELECT LoginID, user \n                           FROM Login \n                           WHERE multi = 65 \n                           AND deleted = 0");
if (!$sql->execute()) {
    echo "Rotate Multi : Failed to get multis to rotate.\n";
    exit(1);
}
Пример #23
0
function generate_invoice_reference()
{
    $handle = DbConnect();
    $year = date("Y");
    $invoice_conf_table = new Table('cc_invoice_conf', 'value');
    $conf_clause = "key_val = 'count_{$year}'";
    $result = $invoice_conf_table->Get_list($handle, $conf_clause, 0);
    if (is_array($result) && !empty($result[0][0])) {
        $count = $result[0][0];
        if (!is_numeric($count)) {
            $count = 0;
        }
        $count++;
        $param_update_conf = "value ='" . $count . "'";
        $clause_update_conf = "key_val = 'count_{$year}'";
        $invoice_conf_table->Update_table($handle, $param_update_conf, $clause_update_conf, $func_table = null);
    } else {
        //insert newcount
        $count = 1;
        $QUERY = "INSERT INTO cc_invoice_conf (key_val ,value) VALUES ( 'count_{$year}', '1');";
        $invoice_conf_table->SQLExec($handle, $QUERY);
    }
    $reference = $year . sprintf("%08d", $count);
    return $reference;
}
Пример #24
0
<?php

//ob_start('ob_gzhandler',9);
$dirclass = "../class";
require '../inc/config.inc.php';
include '../inc/lib.inc.php';
include '../inc/template.inc.php';
DbConnect();
require '../inc/lib_session.inc.php';
if (function_exists("start_debug")) {
    start_debug();
}
$result = myquery("SELECT * FROM game_admins WHERE user_id=" . $user_id . " LIMIT 1");
$adm = mysql_fetch_array($result);
if ($adm['map'] != 1) {
    header('Location: index.php');
    if (function_exists("save_debug")) {
        save_debug();
    }
    exit;
} else {
    require '../inc/template_header.inc.php';
    $img = 'http://' . img_domain . '/race_table/human/table';
    echo '<style type="text/css">@import url("../style/global.css");</style><table width=100% border="0" cellspacing="0" cellpadding="0"><tr><td width="1" height="1"><img src="' . $img . '_lt.gif"></td><td background="' . $img . '_mt.gif"></td><td width="1" height="1"><img src="' . $img . '_rt.gif"></td></tr>
<tr><td background="' . $img . '_lm.gif"></td><td background="' . $img . '_mm.gif" valign="top" width="100%" height="100%">';
    echo '<b><font color=ff0000 size=2 face=verdana>Средиземье :: Редактор карт</font></b><br>';
    if (!isset($option)) {
        $option = '';
    }
    switch ($option) {
        case 'delete_map_now':
Пример #25
0
?>
>Last Login
</SELECT>
<input type="submit" name="search" value="Search"><p>
</th>
</table></form>
<p>
<table bgcolor=#666666 cellspacing=1 cellpadding=8 border=0 width=100%>
<tr bgcolor=#<?php 
echo $bg2;
?>
 >
<th>UserName</th><th>Name</th><th>EMail</th><th>Department</th><th>Workphone</th><th>Online</th>
<?php 
//connect the freeradius db get users from userinfo table
$radlink = @DbConnect($radiushost, $radiususer, $radiuspass, $radiusdb);
if ($_GET[grp]) {
    //show group members
    // do a query, gathering all usernames first
    //SELECT UserName FROM usergroup WHERE GroupName = 'denied' ORDER BY UserName;
    $radquery = Query('usergroup', 'UserName', 'GroupName', '=', $_GET[grp]);
    $radres = @DbQuery($radquery, $radlink);
    if ($radres) {
        while ($row = @DbFetchArray($radres)) {
            // build the string, looks like "UserName = '******'UserName'];
        }
    } else {
        print @DbError($radlink);
    }
    $sta = implode('|', $guser);
Пример #26
0
    $del_rate_table->Delete_table($DBHandle, $CLAUSE);
    Header("Location: A2B_package_manage_rates.php?id={$id}");
}
if (isset($delallrate) && $delallrate) {
    $DBHandle = DbConnect();
    $del_rate_table = new Table("cc_package_rate", "*");
    $CLAUSE = " package_id = " . $id;
    $del_rate_table->Delete_table($DBHandle, $CLAUSE);
    Header("Location: A2B_package_manage_rates.php?id={$id}");
}
$smarty->display('main.tpl');
//load rates
$DBHandle = DbConnect();
$table_rates = new Table("cc_package_rate JOIN cc_ratecard ON cc_ratecard.id = cc_package_rate.rate_id LEFT JOIN cc_prefix ON cc_prefix.prefix = cc_ratecard.destination ", "DISTINCT cc_ratecard.id,cc_prefix.destination, cc_ratecard.dialprefix");
$rates_clauses = " cc_package_rate.package_id = {$id}";
$result_rates = $table_rates->Get_list(DbConnect(), $rates_clauses);
echo $CC_help_offer_package;
?>
<br/>

<SCRIPT LANGUAGE="javascript">
var win= null;
function addrate(selvalue)
{
    //test si win est encore ouvert et close ou refresh
    win=MM_openBrWindow('A2B_entity_def_ratecard.php?popup_select=1&package=<?php 
echo $id;
?>
','','scrollbars=yes,resizable=yes,width=700,height=500');
}
function delrate()
Пример #27
0
        wake($ip, $wol, 9);
    } else {
        echo $nokmsg;
    }
    ?>
<h5>Magic Packet sent to <?php 
    echo $ip;
    ?>
</h5>
<script language="JavaScript"><!--
setTimeout("history.go(-1)",10000);
//--></script>
<?php 
} elseif ($del) {
    if (preg_match("/adm/", $_SESSION['group'])) {
        $link = @DbConnect($dbhost, $dbuser, $dbpass, $dbname);
        $query = GenQuery('nodes', 'd', '', '', '', array('mac'), array('='), array($del));
        if (!@DbQuery($query, $link)) {
            echo "<h4>" . DbError($link) . "</h4>";
        } else {
            echo "<h3>Node {$del} {$delokmsg}</h3>";
        }
        $query = GenQuery('nodiplog', 'd', '', '', '', array('mac'), array('='), array($del));
        if (!@DbQuery($query, $link)) {
            echo "<h4>" . DbError($link) . "</h4>";
        } else {
            echo "<h3>Node IP log {$del} {$delokmsg}</h3>";
        }
        $query = GenQuery('nodiflog', 'd', '', '', '', array('mac'), array('='), array($del));
        if (!@DbQuery($query, $link)) {
            echo "<h4>" . DbError($link) . "</h4>";
Пример #28
0
    echo filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL);
    ?>
">
          <?php 
    if ($popup_select) {
        ?>
                  <input type="hidden" name="popup_select" value="<?php 
        echo $popup_select;
        ?>
" />
          <?php 
    }
    ?>
          <td align="left" width="75%">
                <?php 
    $handle = DbConnect();
    $instance_table = new Table();
    $QUERY = "SELECT code, name FROM cc_iso639 order by code";
    $result = $instance_table->SQLExec($handle, $QUERY);
    if (is_array($result)) {
        $num_cur = count($result);
        for ($i = 0; $i < $num_cur; $i++) {
            $languages_list[$result[$i][0]] = array(0 => $result[$i][0], 1 => $result[$i][1]);
        }
    }
    ?>
                <select NAME="languages" size="1" class="form_input_select" onChange="form.submit()">
                    <?php 
    foreach ($languages_list as $key => $lang_value) {
        ?>
                    <option value='<?php 
Пример #29
0
} else {
	$mycur = $currencies_list[strtoupper($_SESSION['currency'])][2];
	$display_currency = strtoupper($_SESSION['currency']);
	if (strtoupper($_SESSION['currency']) != strtoupper(BASE_CURRENCY))
		$two_currency = true;
}

$HD_Form = new FormHandler("cc_payment_methods", "payment_method");

getpost_ifset(array (
	'item_id',
	'item_type',
	'payment_error'
));

$DBHandle = DbConnect();
$HD_Form->setDBHandler($DBHandle);
$HD_Form->init();

// #### HEADER SECTION

$static_amount = false;
$amount = 0;
if ($item_type = "invoice" && is_numeric($item_id)) {
	$table_invoice = new Table("cc_invoice", "status,paid_status");
	$clause_invoice = "id = " . $item_id;
	$result = $table_invoice->Get_list($DBHandle, $clause_invoice);
	if (is_array($result) && $result[0]['status'] == 1 && $result[0]['paid_status'] == 0) {
		$table_invoice_item = new Table("cc_invoice_item", "COALESCE(SUM(price*(1+(vat/100))),0)");
		$clause_invoice_item = "id_invoice = " . $item_id;
		$result = $table_invoice_item->Get_list($DBHandle, $clause_invoice_item);
Пример #30
0
 function selection()
 {
     global $order;
     $countries = get_countries();
     for ($i = 1; $i < 13; $i++) {
         $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B', mktime(0, 0, 0, $i, 1, 2000)));
     }
     for ($i = 1; $i < 32; $i++) {
         $dom[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i));
     }
     $today = getdate();
     for ($i = $today['year']; $i < $today['year'] + 10; $i++) {
         $expires_year[] = array('id' => strftime('%y', mktime(0, 0, 0, 1, 1, $i)), 'text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)));
     }
     for ($i = $today['year'] - 10; $i <= $today['year']; $i++) {
         $starts_year[] = array('id' => strftime('%y', mktime(0, 0, 0, 1, 1, $i)), 'text' => strftime('%Y', mktime(0, 0, 0, 1, 1, $i)));
     }
     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 = DbConnect();
     $resmax = $DBHandle->query($QUERY);
     $numrow = $resmax->numRows();
     if ($numrow == 0) {
         exit;
     }
     $customer_info = $resmax->fetchRow();
     if ($customer_info[12] != "1") {
         exit;
     }
     $name = $customer_info['firstname'] . ' ' . $customer_info['lastname'];
     $addr1 = $customer_info['address'];
     $addr2 = $customer_info['city'];
     $addr3 = $customer_info['state'];
     $phone = $customer_info['phone'];
     $postcode = $customer_info['zipcode'];
     $countrycode = $customer_info['country'];
     $QUERY = "select countryname from cc_country where countrycode = '{$countrycode}'";
     $resmax = $DBHandle->query($QUERY);
     $numrow = $resmax->numRows();
     $cid = -1;
     if ($numrow == 0) {
         write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . " Country not found");
     } else {
         $country_info = $resmax->fetchRow();
         $country = $country_info['countryname'];
         for ($i = 0; $i < sizeof($countries); $i++) {
             if ($country == $countries[$i]['text']) {
                 $cid = $countries[$i]['id'];
             }
         }
     }
     $selection = array('id' => $this->code, 'module' => $this->title . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $this->get_cc_images(), 'fields' => array(array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_OWNER, 'field' => tep_draw_input_field('CardName', $name) . ' (Override the default values if different )'), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_ADDR1, 'field' => tep_draw_input_field('Addr1', $addr1)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_ADDR2, 'field' => tep_draw_input_field('Addr2', $addr2)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_ADDR3, 'field' => tep_draw_input_field('Addr3', $addr3)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_POSTCODE, 'field' => tep_draw_input_field('PostCode', $postcode)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_COUNTRY, 'field' => tep_draw_pull_down_menu('Country', $countries, $cid)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_TELEPHONE, 'field' => tep_draw_input_field('Telephone', $phone)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_NUMBER, 'field' => tep_draw_input_field('CardNumber')), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_STARTS, 'field' => tep_draw_pull_down_menu('StartDateMonth', $expires_month) . '&nbsp;' . tep_draw_pull_down_menu('StartDateYear', $starts_year)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_EXPIRES, 'field' => tep_draw_pull_down_menu('ExpiryDateMonth', $expires_month) . '&nbsp;' . tep_draw_pull_down_menu('ExpiryDateYear', $expires_year)), array('title' => MODULE_PAYMENT_IRIDIUM_TEXT_ISSUE_NUMBER, 'field' => tep_draw_input_field('IssueNumber', '', "SIZE=5, MAXLENGTH=5") . '(Switch/Solo/Maestro only)'), array('title' => 'CV2 ' . ' ' . '<a href="#" onclick="javascript:window.open(\'' . 'cvv.php' . '\',\'CardNumberSelection\',\'width=600,height=280,top=20,left=100,scrollbars=1\');">' . '<u><i>' . '(' . MODULE_PAYMENT_IRIDIUM_TEXT_CVV_LINK . ')' . '</i></u></a>', 'field' => tep_draw_input_field('CV2', '', "SIZE=4, MAXLENGTH=4"))));
     return $selection;
     /*
              array ('title' => MODULE_PAYMENT_IRIDIUM_TEXT_CREDIT_CARD_DOB,
                                     'field' => tep_draw_pull_down_menu('DOB_day', $dom) . '&nbsp;' .
                                     tep_draw_pull_down_menu('DOB_month', $expires_month) . '&nbsp;' .
                                     tep_draw_pull_down_menu('DOB_year', $dob_year)), */
 }