Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.26 KB | None | 0 0
  1. case 'deposit_js':
  2.         if(!$user) exit(json_encode(array('success'=>false, 'error'=>'You must login to access the deposit.')));
  3.         if($_COOKIE['tid']) {
  4.             exit(json_encode(array('success'=>false, 'error'=>'You isset active tradeoffer.')));
  5.         }
  6.         $sql = $db->query('SELECT `id`,`name` FROM `bots` ORDER BY rand() LIMIT 1');
  7.         $row = $sql->fetch();
  8.         $bot = $row['id'];
  9.         $partner = extract_partner($_GET['tradeurl']);
  10.         $token = extract_token($_GET['tradeurl']);
  11.         setcookie('tradeurl', $_GET['tradeurl'], time() + 3600 * 24 * 7, '/');
  12.         $checksum = intval($_GET['checksum']);
  13.         $prices = file_get_contents('prices.txt');
  14.         $prices = json_decode($prices, true);
  15.         $out = curl('http://'.$ip.':'.(3000+$bot).'/sendTrade/?assetids='.$_GET['assetids'].'&partner='.$partner.'&token='.$token.'&checksum='.$_GET['checksum'].'&steamid='.$user['steamid']);
  16.         $out = json_decode($out, true);
  17.         $out['bot'] = $row['name'];
  18.         if($out['success'] == true) {
  19.  
  20.             //
  21.             //incrementa o valor do item no txt em mais 20%
  22.             //
  23.             //No código abaixo não estou incrementando um item, apenas alterando o preço prices.txt(prices.json)
  24.             $prices['response']['items'][$value['market_hash_name']]['value'] =
  25.             $prices['response']['items'][$value['market_hash_name']]['value'] +
  26.             ($prices['response']['items'][$value['market_hash_name']]['value'] * 0.20);
  27.  
  28.             file_put_contents('prices.txt', json_encode($json_data));
  29.             //Final da linha de código
  30.  
  31.             $s = 0;
  32.             foreach ($out['items'] as $key => $value) {
  33.                 $db->exec('INSERT INTO `items` SET `trade` = '.$db->quote($out['tid']).', `market_hash_name` = '.$db->quote($value['market_hash_name']).', `img` = '.$db->quote($value['icon_url']).', `botid` = '.$db->quote($bot).', `time` = '.$db->quote(time()));
  34.                
  35.                 //NESSA LINHA ELE TRANSFORMA O DINHEIRO EM COINS
  36.                 $s += $prices['response']['items'][$value['market_hash_name']]['value']*10;
  37.             }
  38.             $db->exec('INSERT INTO `trades` SET `id` = '.$db->quote($out['tid']).', `bot_id` = '.$db->quote($bot).', `code` = '.$db->quote($out['code']).', `status` = 0, `user` = '.$db->quote($user['steamid']).', `summa` = '.$db->quote($s).', `time` = '.$db->quote(time()));
  39.             $out['amount'] = $s;
  40.             setcookie('tid', $out['tid'], time() + 3600 * 24 * 7, '/');
  41.         }
  42.         exit(json_encode($out));
  43.         break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement