Вход Регистрация
Файл: online_liqpay.php
Строк: 136
<?
$full_home_path 
= dirname(__FILE__);
require_once(
$full_home_path."/_rootload.php");

$input = '';
foreach (
$_POST as $field=>$value) { 
    if (
$field == "operation_xml") { $value = base64_decode($value); }

    
$input .= $field." ".$value."n";
}
$input = "Входящие параметры:nn$input";

if (
getenv("REQUEST_METHOD") != "POST") { 
    
mconnect();

    
$manager_email=GetSetting('manager_email');

    
$msg = "С IP-адреса $ip произошло обращение к скрипту online_liqpay.php по GET-протоколу.nnБудьте внимательны, т.к. возможно кто-то пытается взломать систему.nn$inputnn--nRootPanel";
    
$subject = "Возможная попытка взлома билинга [LiqPay]";

    
$admEmails=GetAdminEmailsWhereTrueParam("senderror");
    if (
count($admEmails) > 0) {
        
WriteMailLog($subject,$msg);
    }
    while (list(
$i,$em) = @each($admEmails)) {
        
sendmail($em,'',$manager_email,$subject,$msg);
    }

    
mclose();
    exit; 
}

mconnect();
EnableLanguages();

if (
$operation_xml and $signature) {
    
$resp = base64_decode($operation_xml);

    
$resp_array = xml2array($resp);

    
$merchant_id = $resp_array[response][0][merchant_id];
    
$order_id = $resp_array[response][0][order_id];
    
$status = $resp_array[response][0][status];
    
$transaction_id = $resp_array[response][0][transaction_id];
    
$amount = $resp_array[response][0][amount];
    
$sender_phone = $resp_array[response][0][sender_phone];
    
$pay_way = $resp_array[response][0][pay_way];

    
$bill = GetBillById(intval($order_id));
    
$payy = GetPaymentSystemById($bill->paymentSystemId);

    
$liqpay_id=$payy->text1;
    
$liqpay_password=decodePwd($payy->pass1);

    if (
$pay_way == "card") { $merchantNacenka = $payy->small1; }
    else if (
$pay_way == "liqpay") { $merchantNacenka = $payy->small2; }
    else if (
$pay_way == "delayed") { $merchantNacenka = $payy->small3; }

    
$hash = base64_encode(sha1($liqpay_password.$resp.$liqpay_password,1));

    
###
    
$merchantCurrency = $payy->currency; if (!$merchantCurrency) {$merchantCurrency="USD";}
    
$bill->merchantmoney = ($bill->money_host+$bill->money_domain+$bill->money_addons+$bill->money_shop+$bill->money) * GetCurrencyKoeficientByCode($merchantCurrency);
    
$bill->merchantmoney = $bill->merchantmoney + ($bill->merchantmoney/100)*$merchantNacenka; $bill->merchantmoney = round($bill->merchantmoney,2);
    
###

    
if (!$order_id) { $error_msg = "Отсутствует номер счета биллинг-системы."; }
    else if (!
$bill->id) { $error_msg = "Счет # $order_id не найден."; }
    else if (
floatval($amount) < $bill->merchantmoney) { $error_msg = "Неправильная сумма оплаты. Сумма счета в биллинге $bill->merchantmoney."; }
    else if (
$liqpay_id != $merchant_id) { $error_msg = "Неправильный ID мерчанта."; }
    else if (
$status != "success") { $error_msg = "Неправильный статус платежа ($status)."; }
    else if (
$hash != $signature) { $error_msg = "Неправильная контрольная подпись."; }
    else {
        
MakeBillPayed($bill->id,1,"LiqPay Merchant ($sender_phone)");
        
mclose();
        exit;
    }

    
$manager_email=GetSetting('manager_email');

    
$msg = "Автоматическая оплата через LiqPay Merchant отклонена биллинг-системой по причине:nn$error_msgnn$inputnnSHA1 by RootPanel: ".$hash."nnIP: $ipnn--nRootPanel";
    
$subject = "Ошибка автоматической оплаты [LiqPay]";

    
$admEmails=GetAdminEmailsWhereTrueParam("senderror");
    if (
count($admEmails) > 0) {
        
WriteMailLog($subject,$msg);
    }
    while (list(
$i,$em) = @each($admEmails)) {
        
sendmail($em,'',$manager_email,$subject,$msg);
    }
    
mclose();
}

?>
Онлайн: 0
Реклама