Advertisement
enos

send

Mar 31st, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.18 KB | None | 0 0
  1. <?php
  2. session_start();
  3. error_reporting(0);
  4.  
  5. if(isset($_SESSION['steamid'])) {
  6. include 'config.php';
  7. include 'functions.php';
  8. include("trade.php");
  9.  
  10. if(isset($_POST['id_item']) ) {
  11.     $randcode = generateRandomString();
  12. //dari hasil post
  13.  $steamid = sacarXss($_SESSION['steamid']);
  14.  $points = $randcode;
  15.  $item = sacarXss($_POST['id_item']);
  16.  $price = htmlspecialchars($_POST['price']);
  17.  $lp = strlen($price);
  18.  $angka = is_numeric($_POST['price']);
  19.  
  20.  
  21.  
  22.  
  23.     if($lp > 12 && $angka != 1 ){
  24.             $respons['text5']='<div class="alert alert-success" id="id-tradeofferid"><br>
  25.             <h4>Silakan Masukkan Format Harga Yang Benar </h4></div>';
  26.             print json_encode($respons);
  27.     }
  28.      elseif($lp > 12 && $angka == 1){
  29.             $respons['text5']='<div class="alert alert-success" id="id-tradeofferid"><br>
  30.             <h4>Silakan Masukkan Format Harga Yang Benar </h4></div>';
  31.             print json_encode($respons);
  32.     }
  33.     elseif($lp <= 12 && $angka != 1){
  34.         $respons['text5']='<div class="alert alert-success" id="id-tradeofferid"><br>
  35.             <h4>Format Harga Salah </h4></div>';
  36.             print json_encode($respons);
  37.     }
  38.    
  39.     elseif($lp <= 12 && $angka == 1){
  40.                
  41.         //ambil cookie dan session dari database
  42.         $bot_id = '1';
  43.         $sessionid = get_Session($mysqli, $bot_id);
  44.         $cookie = get_Cookies($mysqli, $bot_id);
  45.         $newcookie = str_replace(",", "; ", $cookie);
  46.  
  47.         //Ambil NIlai Token dan Pertner User from tradeurl
  48.         $tt = get_TradeurlUser($mysqli, $steamid);
  49.         $trade_parts = explode("=",$tt);
  50.         $token = $trade_parts[1];
  51.         $trade_token = $trade_parts[count($trade_parts)-1]; //TOKEN
  52.         //echo "<br>TOKEN: " .$trade_token ."<br>";
  53.         $partner = str_replace("&token", "", $token); //PARTNER
  54.        
  55.        
  56.         $SteamAuth = new SteamAuth;
  57.         //$randcode = $SteamAuth->generateRandomString();
  58.         $responsemtrade = $SteamAuth->MakeTrade($sessionid, $newcookie, $partner, $trade_token, '[{"0":"'.$item.'"}]', $points);
  59.         $a = json_decode($responsemtrade, true);
  60.         //echo $a['tradeofferid'];
  61.         $t = $a['tradeofferid'];
  62.        
  63.        
  64.         //cek....
  65.         if($t == ''){
  66.             $respons['text5']='<div class="alert alert-success" id="id-tradeofferid"><br> <h4>Error, Silakan Diulang</h4></div>';
  67.             print json_encode($respons);
  68.         } else {
  69.             insert_Offer($mysqli, $t, $steamid, $points, $price);
  70.             $respons['text5']='<div class="alert alert-success" id="id-tradeofferid">
  71.                         <p>Your sale has been assigned to <a href="#" target="_blank">storage account </a></p>
  72.                         <p><strong> Your security token is: "'.$points.'".</strong></p>
  73.                         <br>
  74.                         <h4>Open TradeOffer:</h4>
  75.                        
  76.                         <span class="offer-links">
  77.                             <a type="button" class="btn btn-orange" id="btnTrade" href="javascript:ShowTradeOffer('.$t.')">Click Here'.$t.'</a>
  78.                             <br>
  79.                            
  80.                             <p>Before your items are listed for sale, you need to accept the trade offer weve just sent you so our storage accounts can securely hold your items. You can request unsold items back at any time from your account page.</p>
  81.                             <br>
  82.                             <p>Trade offers may be canceled after 5 minutes of inactivity. After that time, you must resend the offer from your account page.</p>
  83.                            
  84.                         </span>
  85.                         </div>';
  86.                        
  87.         print json_encode($respons);
  88.         }
  89.        
  90.     }
  91.    
  92.    
  93.  
  94.  
  95.        
  96.    
  97.        
  98.        
  99.  
  100. }
  101. }
  102. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement