function process($data, $config)
 {
     $url = "https://secure.quantumgateway.com/cgi/tqgwdbe.php";
     $LOGINURL = "{$url}";
     $agent = "BrilliantRetail Gateway Processor 1.0";
     $POSTFIELDS = "&gwlogin="******"&ccnum=" . $data['cdg_ccnum'] . "&ccmo=" . $data['cdg_ccmo'] . "&ccyr=" . $data['cdg_ccyr'] . "&amount=" . $data['order_total'] . "&BADDR1=" . $data["br_billing_address1"] . $data["br_billing_address2"] . "&BZIP1=" . $data['br_billing_zip'] . "&BCUST_EMAIL=" . $data['email'] . "&BNAME=" . $data["br_billing_fname"] . ' ' . $data["br_billing_lname"] . "&Dsep=Pipe" . "&CVVtype=1" . "&CVV2=" . $data['cdg_cvv2'] . "&customer_ip=" . $_SERVER['REMOTE_ADDR'] . "&MAXMIND=1";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $LOGINURL);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
     curl_setopt($ch, CURLOPT_USERAGENT, $agent);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $POSTFIELDS);
     curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $result = curl_exec($ch);
     curl_close($ch);
     $responseArray = explode("|", $result);
     if (trim(clear_quotes($responseArray[0])) != "APPROVED") {
         $trans = array('error' => "Error Code : " . clear_quotes($responseArray[7]) . "(" . clear_quotes($responseArray[6]) . ")");
     } else {
         $details = array("Method" => "CDG", "Approval Code" => clear_quotes($responseArray[1]), "Transaction ID" => clear_quotes($responseArray[2]), "Transaction Ref" => $data['transaction_id'], "Transaction Info" => clear_quotes($responseArray[7]));
         // Return the trans details
         $trans = array('status' => 3, 'transaction_id' => clear_quotes($responseArray[2]), 'payment_type' => 'CDG', 'amount' => $data["order_total"], 'details' => serialize($details), 'approval' => clear_quotes($responseArray[1]));
     }
     return $trans;
 }
Example #2
0
}
if (file_exists(ABSPATH . 'db_config.php') && !@$_POST['mysql_host']) {
    require_once ABSPATH . 'db_config.php';
    $tpl['mysql_host'] = DB_HOST;
    $tpl['mysql_port'] = DB_PORT;
    $tpl['mysql_db_name'] = DB_NAME;
    $tpl['mysql_username'] = DB_USER;
    $tpl['mysql_password'] = DB_PASSWORD;
    $tpl['mysql_prefix'] = DB_PREFIX;
} else {
    $tpl['mysql_host'] = clear_quotes($_POST['mysql_host']);
    $tpl['mysql_port'] = clear_quotes($_POST['mysql_port']);
    $tpl['mysql_db_name'] = clear_quotes($_POST['mysql_db_name']);
    $tpl['mysql_username'] = clear_quotes($_POST['mysql_username']);
    $tpl['mysql_password'] = clear_quotes($_POST['mysql_password']);
    $tpl['mysql_prefix'] = clear_quotes(@$_POST['mysql_prefix']);
    if (!check_input_data($tpl['mysql_prefix'], 'db_prefix')) {
        die('bad mysql_prefix');
    }
}
// проверям, можно ли подключиться к БД
$tpl['mysql_port'] = !empty($tpl['mysql_port']) ? $tpl['mysql_port'] : 3306;
$mysqli_link = mysqli_connect($tpl['mysql_host'], $tpl['mysql_username'], $tpl['mysql_password'], $tpl['mysql_db_name'], $tpl['mysql_port']);
if (mysqli_connect_errno()) {
    $tpl['error'][] = 'Error connecting to MySQL : ' . mysqli_connect_errno() . ' ' . mysqli_connect_error();
}
if (!isset($tpl['error'])) {
    require_once ABSPATH . 'includes/MySQLidb.php';
    $db = new MySQLidb($tpl['mysql_host'], $tpl['mysql_username'], $tpl['mysql_password'], $tpl['mysql_db_name'], $tpl['mysql_port']);
    $db_name = $tpl['mysql_db_name'];
    $prefix = $tpl['mysql_prefix'];