SHARE
TWEET

Untitled

a guest Nov 17th, 2019 135 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. header("Content-type: application/json; charset=utf-8");
  3.  
  4. define("USEKEY","dc4c47bc-ebea-4f08-9799-097a6caaed19");
  5.  
  6. require('db.php');
  7.  
  8. $key           = (isset($_GET['key'])) ? $_GET['key'] : '';
  9.  
  10. $ExchangeRates = (isset($_GET['rate'])) ? $_GET['rate'] : '';
  11. $base          = (isset($_GET['base'])) ? $_GET['base'] : '';
  12.  
  13. $uid           = (isset($_GET['uid'])) ? $_GET['uid'] : '';
  14. $gold          = (isset($_GET['gold'])) ? $_GET['gold'] : '';
  15.  
  16.  
  17.  
  18. if($key == USEKEY){
  19.     if($ExchangeRates != "" && $base != "" && $uid != "" && $gold != "" ){
  20.         if (is_numeric($ExchangeRates) && is_numeric($base) && is_numeric($uid) && is_numeric($gold)){
  21.             $sqlGame = "SELECT * FROM `t_user` WHERE pid='".$uid."'";
  22.             $resultGame = $conGame->query($sqlGame);
  23.             $rowGame = $resultGame->fetch_assoc();
  24.             if($rowGame){
  25.                 $order_id = time() . $uid . mt_rand(10, 99);
  26.  
  27.                 /*$FreeGolds = ($gold * $ExchangeRates) * $base - ($gold * $ExchangeRates);
  28.                 $NormalGolds = $gold * $ExchangeRates;*/
  29.                 $FreeGolds = $gold;
  30.                 $NormalGolds = $gold;
  31.                        
  32.                 $cmd = "cd /home/pirate/bin && ./btscript game20001 /home/pirate/rpcfw/test/AddOrder.php {$rowGame['uid']} {$order_id} {$NormalGolds} {$FreeGolds}";
  33.                 passthru($cmd);
  34.        
  35.                 $response = array(
  36.                     "code" => 200,
  37.                     "message" => "success"                 
  38.                 );
  39.                 die(json_encode($response,true));
  40.             }else{
  41.                 $response = array(
  42.                     "code" => 400,
  43.                     "message" => "กรุณาสร้างตัวละครในเกมก่อน"
  44.                 );
  45.                 die(json_encode($response,true));
  46.             }
  47.         }else{
  48.             $response = array(
  49.                 "code" => 400,
  50.                 "message" => "parameter is not numeric"
  51.             );
  52.             die(json_encode($response,true));
  53.         }
  54.     }else{
  55.         $response = array(
  56.             "code" => 400,
  57.             "message" => "invalid parameter"
  58.         );
  59.         die(json_encode($response,true));
  60.     }    
  61. }else{
  62.     $response = array(
  63.         "code" => 400,
  64.         "message" => "invalid key"
  65.     );
  66.     die(json_encode($response,true));
  67. }
  68.  
  69.  
  70.  
  71. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top