Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.03 KB | None | 0 0
  1. <?
  2. include ("conf.php");
  3. // include ("connect.php");
  4. // include ("functions.php");
  5. $secret_key="AvPLoMhBt";
  6. ############################################################
  7. $customer_id=protect_int($_GET["customer_id"]);
  8. $datetime=protect_str($_GET["datetime"]);
  9. $transaction_id=protect_str($_GET["transaction_id"]);
  10. $key=protect_str($_GET["key"]);
  11. $amount=protect_int($_GET["amount"]);
  12. #echo $my_key=$my_key=MD5($transaction_id.$secret_key);
  13. $db = mysql_fetch_array(mysql_query("SELECT users.*, info.* FROM `users` LEFT JOIN info ON info.id_pers=users.id WHERE users.id='".$customer_id."'"));
  14. $login=iconv("windows-1251","UTF-8",$db["login"]);
  15. $name=iconv("windows-1251","UTF-8",$db["name"]);
  16. ############################################################
  17. if ($break)
  18. {
  19.     $xml = new SimpleXMLElement('<Response/>');
  20.     $xml->addChild('StatusCode', 11);
  21.     $xml->addChild('StatusDetail', 'Temporary error');
  22.     $xml->addChild('DateTime', $datetime);
  23.    
  24.     $AccountInfo=$xml->addChild('AccountInfo');
  25.     $AccountInfo->addChild('login', '');
  26.     $AccountInfo->addChild('name', '');
  27.     $AccountInfo->addChild('balans', '');
  28.     Header('Content-type: text/xml');
  29.     print($xml->asXML());
  30. }
  31. else
  32. {
  33.     ############################################################
  34.     if($_GET["action"]=="check")
  35.     {
  36.         $my_key=MD5($customer_id.$transaction_id.$secret_key);
  37.         if($my_key!=$key)
  38.         {
  39.             $xml = new SimpleXMLElement('<Response/>');
  40.             $xml->addChild('StatusCode', 6);
  41.             $xml->addChild('StatusDetail', 'Verify sign error');
  42.             $xml->addChild('DateTime', $datetime);
  43.            
  44.             $AccountInfo=$xml->addChild('AccountInfo');
  45.             $AccountInfo->addChild('login', '');
  46.             $AccountInfo->addChild('name', '');
  47.             $AccountInfo->addChild('balans', '');
  48.             Header('Content-type: text/xml');
  49.             print($xml->asXML());
  50.         }
  51.         else
  52.         {
  53.             if($db)
  54.             {
  55.                 $xml = new SimpleXMLElement('<Response/>');
  56.                 $xml->addChild('StatusCode', 0);
  57.                 $xml->addChild('StatusDetail', 'OK');
  58.                 $xml->addChild('DateTime', $datetime);
  59.                
  60.                 $AccountInfo=$xml->addChild('AccountInfo');
  61.                 $AccountInfo->addChild('login', $login);
  62.                 $AccountInfo->addChild('name', $name);
  63.                 $AccountInfo->addChild('balans', $db["manat"]);
  64.                 Header('Content-type: text/xml');
  65.                 print($xml->asXML());
  66.             }
  67.             else
  68.             {
  69.                 $xml = new SimpleXMLElement('<Response/>');
  70.                 $xml->addChild('StatusCode', 2);
  71.                 $xml->addChild('StatusDetail', 'Wrong account');
  72.                 $xml->addChild('DateTime', $datetime);
  73.                
  74.                 $AccountInfo=$xml->addChild('AccountInfo');
  75.                 $AccountInfo->addChild('login', '');
  76.                 $AccountInfo->addChild('name', '');
  77.                 $AccountInfo->addChild('balans', '');
  78.                 Header('Content-type: text/xml');
  79.                 print($xml->asXML());
  80.             }
  81.         }
  82.     }
  83.     ############################################################   
  84.     else if($_GET["action"]=="pay")
  85.     {
  86.         $my_key=MD5($customer_id.$transaction_id.$amount.$secret_key);
  87.         if($my_key!=$key)
  88.         {
  89.             $xml = new SimpleXMLElement('<Response/>');
  90.             $xml->addChild('StatusCode', 6);
  91.             $xml->addChild('StatusDetail', 'Verify sign error');
  92.             $xml->addChild('PaymentID', 0);
  93.             $xml->addChild('OrderDate', $datetime);
  94.             Header('Content-type: text/xml');
  95.             print($xml->asXML());
  96.         }
  97.         else
  98.         {
  99.             if($db)
  100.             {
  101.                 // $give_amount=8*$amount;
  102.                 $give_amount=$amount;
  103.            
  104.                 mysql_query("UPDATE users SET manat=manat+".$give_amount." WHERE id='".$db["id"]."'");
  105.                
  106.                 // mysql_query("INSERT INTO compl(sender, receiver, manat, transaction_id, OrderDate) VALUES('eManat', '".$db["login"]."', '".$amount."', '".$transaction_id."', '".$datetime." | OldManat=".$db["manat"]." | Bonus=".$give_amount."')");
  107.                 $PaymentID=mysql_insert_id();
  108.                 mysql_query("INSERT INTO pochta(user, whom, text, subject) VALUES ('Банкир','".$db['login']."','amount: ".$amount." AZN, bonus: ".$give_amount." AZN, transaction id: ".$transaction_id.", OrderDate: ".$datetime."', 'eManat оплата')");
  109.                 // history($db["login"],"eManat","amount: ".$amount." AZN, Bonus: ".$give_amount." AZN, transaction id: ".$transaction_id, $ip, "eManat");
  110.                 $xml = new SimpleXMLElement('<Response/>');
  111.                 $xml->addChild('StatusCode', 0);
  112.                 $xml->addChild('StatusDetail', 'OK');
  113.                 $xml->addChild('PaymentID', $PaymentID);
  114.                 $xml->addChild('OrderDate', $datetime);
  115.                 Header('Content-type: text/xml');
  116.                 print($xml->asXML());
  117.             }
  118.             else
  119.             {
  120.                 $xml = new SimpleXMLElement('<Response/>');
  121.                 $xml->addChild('StatusCode', 2);
  122.                 $xml->addChild('StatusDetail', 'Wrong account');
  123.                 $xml->addChild('PaymentID', 0);
  124.                 $xml->addChild('OrderDate', $datetime);
  125.                 Header('Content-type: text/xml');
  126.                 print($xml->asXML());
  127.             }
  128.         }
  129.     }
  130.     ############################################################
  131.     else if($_GET["action"]=="status")
  132.     {
  133.         $my_key=MD5($transaction_id.$secret_key);
  134.         if($my_key!=$key)
  135.         {
  136.             $xml = new SimpleXMLElement('<Response/>');
  137.             $xml->addChild('StatusCode', 6);
  138.             $xml->addChild('StatusDetail', 'Verify sign error');
  139.             $xml->addChild('PaymentID', 0);
  140.             $xml->addChild('Amount', 0);
  141.             $xml->addChild('OrderDate', 0);
  142.             Header('Content-type: text/xml');
  143.             print($xml->asXML());
  144.         }
  145.         else
  146.         {
  147.             $have_transaction=mysql_fetch_array(mysql_query("SELECT * FROM compl WHERE transaction_id='".$transaction_id."'"));
  148.             if($have_transaction)
  149.             {
  150.                 $xml = new SimpleXMLElement('<Response/>');
  151.                 $xml->addChild('StatusCode', 0);
  152.                 $xml->addChild('StatusDetail', 'OK');
  153.                 $xml->addChild('PaymentID', $have_transaction["id"]);
  154.                 $xml->addChild('Amount', $have_transaction["manat"]);
  155.                 $xml->addChild('OrderDate', $have_transaction["date"]);
  156.                 Header('Content-type: text/xml');
  157.                 print($xml->asXML());
  158.             }
  159.             else
  160.             {
  161.                 $xml = new SimpleXMLElement('<Response/>');
  162.                 $xml->addChild('StatusCode', 2);
  163.                 $xml->addChild('StatusDetail', 'Wrong account');
  164.                 $xml->addChild('PaymentID', 0);
  165.                 $xml->addChild('Amount', 0);
  166.                 $xml->addChild('OrderDate', 0);
  167.                 Header('Content-type: text/xml');
  168.                 print($xml->asXML());
  169.             }
  170.         }
  171.     }
  172.     ############################################################
  173. }
  174. mysql_close();
  175. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement