Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Copyright (c) 2015 Jordan Turley, CSGO Win Big. All Rights Reserved.
- include 'default.php';
- $db = getDB();
- $maxPotCount = 60;
- # Get password, owner steam ID, and all deposit items
- $password = isset($_POST['password']) ? $_POST['password'] : null;
- $tradeOwnerSteamId32 = isset($_POST['owner']) ? $_POST['owner'] : null;
- $allItemsJson = isset($_POST['items']) ? $_POST['items'] : null;
- if (is_null($password) || is_null($tradeOwnerSteamId32) || is_null($allItemsJson) || strlen($password) === 0 || strlen($tradeOwnerSteamId32) === 0 || strlen($allItemsJson) === 0) {
- echo jsonErr('One of the required fields was not sent correctly or was left blank.');
- return;
- }
- # Convert Steam ID to Steam64 ID
- $idParts = explode(':', $tradeOwnerSteamId32);
- $authServer = intval($idParts[1]);
- $accountNumber = intval($idParts[2]);
- $tradeOwnerSteamId64 = $accountNumber * 2 + 76561197960265728 + $authServer;
- # Get the password from config file and make sure it matches
- $realPassword = "Pironi";
- if ($password !== $realPassword) {
- echo jsonErr('The password was incorrect.');
- return;
- }
- # Create all items array from json
- $allItems = json_decode($allItemsJson, true);
- $totalPrice = 0;
- $itemsArr = array();
- # Get the bot's inventory
- $botInventory = json_decode(file_get_contents("https://steamcommunity.com/profiles/(hiding this from pastebin)/inventory/json/730/2"), true);
- if ($botInventory['success'] !== true) {
- echo jsonErr('An error occured fetching the bot\'s inventory.');
- return;
- }
- $rgInventory = $botInventory['rgInventory'];
- $rgDescriptions = $botInventory['rgDescriptions'];
- function clean3($string) {
- $string = str_replace(' ', '-', $string);
- $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string);
- return preg_replace('/-+/', '-', $string);
- }
- # Loop through each item and get their name and price, and add them to the database
- foreach ($allItems as $item) {
- $classId = $item['classId'];
- $instanceId = $item['instanceId'];
- $marketName = $item['marketName'];
- $rarityName = $item['rarityName'];
- $rarityColor = $item['rarityColor'];
- $price = $item['price'];
- $iconUrl = $item['iconUrl'];
- $creditinsert = clean3($price);
- $sql =
- 'INSERT INTO deposited
- (classId, instanceId, ownerSteamId64, ownerSteamId32, itemName, itemPrice, itemRarityName, itemRarityColor, itemIcon)
- VALUES
- (:class, :instance, :owner64, :owner32, :itemname, :itemprice, :itemrarityname, :itemraritycolor, :itemicon)';
- $stmt = $db->prepare($sql);
- $stmt->bindValue(':class', $classId);
- $stmt->bindValue(':instance', $instanceId);
- $stmt->bindValue(':owner64', $tradeOwnerSteamId64);
- $stmt->bindValue(':owner32', $tradeOwnerSteamId32);
- $stmt->bindValue(':itemname', $marketName);
- $stmt->bindValue(':itemprice', $price);
- $stmt->bindValue(':itemrarityname', $rarityName);
- $stmt->bindValue(':itemraritycolor', $rarityColor);
- $stmt->bindValue(':itemicon', $iconUrl);
- $stmt->execute();
- $sql2 =
- "
- UPDATE users SET credits=credits + '".$creditinsert."' WHERE steamid = '".$tradeOwnerSteamId64."'
- ";
- mysql_connect("localhost", "root", "");
- @mysql_select_db("test");
- mysql_query($sql2);
- }
- # If the pot was not over the top, potOver = 0
- $data = array('minDeposit' => 1, 'potOver' => 0);
- echo jsonSuccess($data);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement