Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- include ("conf.php");
- // include ("connect.php");
- // include ("functions.php");
- $secret_key="AvPLoMhBt";
- ############################################################
- $customer_id=protect_int($_GET["customer_id"]);
- $datetime=protect_str($_GET["datetime"]);
- $transaction_id=protect_str($_GET["transaction_id"]);
- $key=protect_str($_GET["key"]);
- $amount=protect_int($_GET["amount"]);
- #echo $my_key=$my_key=MD5($transaction_id.$secret_key);
- $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."'"));
- $login=iconv("windows-1251","UTF-8",$db["login"]);
- $name=iconv("windows-1251","UTF-8",$db["name"]);
- ############################################################
- if ($break)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 11);
- $xml->addChild('StatusDetail', 'Temporary error');
- $xml->addChild('DateTime', $datetime);
- $AccountInfo=$xml->addChild('AccountInfo');
- $AccountInfo->addChild('login', '');
- $AccountInfo->addChild('name', '');
- $AccountInfo->addChild('balans', '');
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- ############################################################
- if($_GET["action"]=="check")
- {
- $my_key=MD5($customer_id.$transaction_id.$secret_key);
- if($my_key!=$key)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 6);
- $xml->addChild('StatusDetail', 'Verify sign error');
- $xml->addChild('DateTime', $datetime);
- $AccountInfo=$xml->addChild('AccountInfo');
- $AccountInfo->addChild('login', '');
- $AccountInfo->addChild('name', '');
- $AccountInfo->addChild('balans', '');
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- if($db)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 0);
- $xml->addChild('StatusDetail', 'OK');
- $xml->addChild('DateTime', $datetime);
- $AccountInfo=$xml->addChild('AccountInfo');
- $AccountInfo->addChild('login', $login);
- $AccountInfo->addChild('name', $name);
- $AccountInfo->addChild('balans', $db["manat"]);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 2);
- $xml->addChild('StatusDetail', 'Wrong account');
- $xml->addChild('DateTime', $datetime);
- $AccountInfo=$xml->addChild('AccountInfo');
- $AccountInfo->addChild('login', '');
- $AccountInfo->addChild('name', '');
- $AccountInfo->addChild('balans', '');
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- }
- }
- ############################################################
- else if($_GET["action"]=="pay")
- {
- $my_key=MD5($customer_id.$transaction_id.$amount.$secret_key);
- if($my_key!=$key)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 6);
- $xml->addChild('StatusDetail', 'Verify sign error');
- $xml->addChild('PaymentID', 0);
- $xml->addChild('OrderDate', $datetime);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- if($db)
- {
- // $give_amount=8*$amount;
- $give_amount=$amount;
- mysql_query("UPDATE users SET manat=manat+".$give_amount." WHERE id='".$db["id"]."'");
- // 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."')");
- $PaymentID=mysql_insert_id();
- 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 оплата')");
- // history($db["login"],"eManat","amount: ".$amount." AZN, Bonus: ".$give_amount." AZN, transaction id: ".$transaction_id, $ip, "eManat");
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 0);
- $xml->addChild('StatusDetail', 'OK');
- $xml->addChild('PaymentID', $PaymentID);
- $xml->addChild('OrderDate', $datetime);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 2);
- $xml->addChild('StatusDetail', 'Wrong account');
- $xml->addChild('PaymentID', 0);
- $xml->addChild('OrderDate', $datetime);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- }
- }
- ############################################################
- else if($_GET["action"]=="status")
- {
- $my_key=MD5($transaction_id.$secret_key);
- if($my_key!=$key)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 6);
- $xml->addChild('StatusDetail', 'Verify sign error');
- $xml->addChild('PaymentID', 0);
- $xml->addChild('Amount', 0);
- $xml->addChild('OrderDate', 0);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- $have_transaction=mysql_fetch_array(mysql_query("SELECT * FROM compl WHERE transaction_id='".$transaction_id."'"));
- if($have_transaction)
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 0);
- $xml->addChild('StatusDetail', 'OK');
- $xml->addChild('PaymentID', $have_transaction["id"]);
- $xml->addChild('Amount', $have_transaction["manat"]);
- $xml->addChild('OrderDate', $have_transaction["date"]);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- else
- {
- $xml = new SimpleXMLElement('<Response/>');
- $xml->addChild('StatusCode', 2);
- $xml->addChild('StatusDetail', 'Wrong account');
- $xml->addChild('PaymentID', 0);
- $xml->addChild('Amount', 0);
- $xml->addChild('OrderDate', 0);
- Header('Content-type: text/xml');
- print($xml->asXML());
- }
- }
- }
- ############################################################
- }
- mysql_close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement