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

if (
$command == "check" or $command == "pay") {
    
mconnect();

    
$userBalanceEnable GetSetting("userBalanceEnable");

    
$paysystem = @mysql_query("select * from pay_systems where type='taulinkkz'");
    
$paysystem = @mysql_fetch_object($paysystem);

    if (
$paysystem->active and $userBalanceEnable) {
        
$taulinkkz_ip $paysystem->area1;

        if (
$taulinkkz_ip) {
            if (
IsIPInIPs($ip,$taulinkkz_ip)) {
                if (
preg_match("/^d+$/",$account)) {
                    
$user GetUserById($account);
                    if (
$user->id) {
                        if (
$command == "check") {
                            
$resp[result] = "0";
                            
$resp[comment] = "OK";
                        } 
                        else if (
$command == "pay") {
                            if (
$sum 0) {
                                if (
$txn_id and preg_match("/^d{14}$/",$txn_date)) {
                                    
$bill = @mysql_query("select id from bills where merchantId='$txn_id' and merchantType='taulinkkz'");
                                    if (@
mysql_num_rows($bill) > 0) {
                                        
$bill = @mysql_fetch_object($bill);
                                        
$prv_txn $bill->id;

                                        
$resp[result] = "0";
                                        
$resp[comment] = "OK (транзакция уже существует)";
                                        
$resp[sum] = $sum;
                                        
$resp[txn_id] = $txn_id;
                                        
$resp[prv_txn] = $prv_txn;
                                    }
                                    else {
                                        
preg_match("/^(d{4})(d{2})(d{2})(d{2})(d{2})(d{2})$/",$txn_date,$arr);
                                        
$sql_date=$arr[1]."-".$arr[2]."-".$arr[3];

                                        
$m_res = @mysql_query("insert into bills (uid,money,created,addfunds,history,merchantmoney,merchantId,merchantType) values('$user->id','$sum','$sql_date','1','$user->login','$sum','$txn_id','taulinkkz')");
                                        
$prv_txn mysql_insert_id();

                                        if (
$m_res and $prv_txn) {
                                            
MakeBillPayed($prv_txn,1,"Taulink KZ (txn_id: $txn_id)");

                                            
$resp[result] = "0";
                                            
$resp[comment] = "OK (транзакция создана)";
                                            
$resp[sum] = $sum;
                                            
$resp[txn_id] = $txn_id;
                                            
$resp[prv_txn] = $prv_txn;
                                        } 
                                        else {
                                            
$resp[result] = "1";
                                            
$resp[comment] = "Не удалось создать транзакцию.";
                                            
$resp[sum] = $sum;
                                            
$resp[txn_id] = $txn_id;
                                            
$resp[prv_txn] = "";
                                        }
                                    }
                                }
                                else {
                                    
$resp[result] = "300";
                                    
$resp[comment] = "Отсутствует идентификатор транзакции txn_id или дата транзакции txn_date.";
                                    
$resp[sum] = $sum;
                                    
$resp[txn_id] = $txn_id;
                                    
$resp[prv_txn] = "";
                                }
                            } 
                            else {
                                
$resp[result] = "241";
                                
$resp[comment] = "Сумма платежа не может быть меньше или равна нулю.";
                                
$resp[sum] = $sum;
                                
$resp[txn_id] = $txn_id;
                                
$resp[prv_txn] = "";
                            }
                        }
                    } 
                    else {
                        
$resp[result] = "5";
                        
$resp[comment] = "Идентификатор абонента не найден.";
                        if (
$command == "pay") {
                            
$resp[sum] = $sum;
                            
$resp[txn_id] = $txn_id;
                            
$resp[prv_txn] = "";
                        }
                    }
                } 
                else {
                    
$resp[result] = "4";
                    
$resp[comment] = "Неверный формат идентификатора абонента.";
                    if (
$command == "pay") {
                        
$resp[sum] = $sum;
                        
$resp[txn_id] = $txn_id;
                        
$resp[prv_txn] = "";
                    }
                }
            }
            else {
                
$resp[result] = "300";
                
$resp[comment] = "IP-адрес $ip отсутствует в списке доступа.";
            }
        }
        else {
            
$resp[result] = "300";
            
$resp[comment] = "Не задан список IP-адресов для доступа.";
        }
    } 
    else {
        
$resp[result] = "7";
        
$resp[comment] = "Прием платежа запрещен провайдером.";
        if (
$command == "pay") {
            
$resp[sum] = $sum;
            
$resp[txn_id] = $txn_id;
            
$resp[prv_txn] = "";
        }
    }

else if (
$command) {
    
$resp[result] = "300";
    
$resp[comment] = "Неизвестная комманда command=$command.";

else {
    
$resp[result] = "300";
    
$resp[comment] = "Не указана комманда command.";
}

header("Content-type: text/xml");
print 
"<?xml version="1.0" encoding="UTF-8"?>
<response>"
;
while (list(
$k,$v) = @each($resp)) {
    print 
"<".$k.">$v</".$k.">";
}
print 
"</response>";

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