$fetch_string = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $api_key . "&steamids=" . $_SESSION["steam_id"]; $user_JSON_data = @file_get_contents($fetch_string); if ($user_JSON_data === FALSE) { header("Location: /error.php"); } $user_data = json_decode($user_JSON_data); if (count($user_data->response->players) == 1) { $player = $user_data->response->players[0]; $avatar_url_parts = explode("/", $player->avatar); $part_count = count($avatar_url_parts); $avatar_url = $avatar_url_parts[$part_count - 2]; $avatar_url .= "/"; $avatar_url .= strtok($avatar_url_parts[$part_count - 1], "."); $user_name = htmlspecialchars($player->personaname, ENT_QUOTES); query_setUserSteamDetails($mysqli, $_SESSION["user_id"], $player->personaname, $avatar_url); query_getUserByUserID($mysqli, $user, $_SESSION["user_id"]); $_SESSION["steam_name"] = $user_name; $_SESSION["steam_avatar"] = $avatar_url; $_SESSION["trade_token"] = $user['trade_token']; } header("Location: " . $redirect_page); } query_getGlobalInformation($mysqli, $global_info); if (!empty($_SESSION["user_id"])) { query_updateUserLastActivity($mysqli, $_SESSION["user_id"], time()); } query_getGlobalInformation($mysqli, $global_info); ?> <!DOCTYPE html> <html>
</div> <div class="text_right tab_edge tab_colour tab_medium_size"> Value: $<?php echo $pot["pot_total"]; ?> </div> <div class="game_titles"> <div class="game_name tab_colour"> Name: </div> <div class="game_percentage tab_colour"> Chance: </div> <div class="game_value tab_colour"> Value: </div> <div class="game_winner tab_colour"> Winner: </div> </div> <?php foreach ((array) $pot_user_history as $user_info) { query_getUserByUserID($mysqli, $user_data, $user_info["user_id"]); ?> <?php $winner = false; if ($user_info["user_id"] == $pot["pot_winner_id"]) { $winner = true; } ?> <div class="game_row <?php if ($winner) { echo "winner_colour"; } ?> "> <div class="game_name"> <?php echo $user_data["steam_name"];
$current_pot_id = $global_info["current_pot_id"]; query_getAllPotItems($mysqli, $pot_items, $current_pot_id); $users_in_pot = array(); if ($pot_items) { foreach ($pot_items as $pot_item) { $item_id = $pot_item["item_id"]; query_getItemByItemID($mysqli, $inventory_item, $item_id); $user_id = $inventory_item["user_id"]; if (!array_key_exists($user_id, $users_in_pot)) { $users_in_pot[$user_id] = array(); } array_push($users_in_pot[$user_id], $inventory_item); } } foreach ($users_in_pot as $user_id => $user_items) { query_getUserByUserID($mysqli, $user_data, $user_id); $totalPricing = 0; foreach ($user_items as $item) { query_getItemInformationByInfoID($mysqli, $item_info, $item["item_information_id"]); $totalPricing += $item_info["price"]; } ?> <div class="trackzone" amount="<?php echo number_format($totalPricing, 2); ?> " user_id="<?php echo $user_id; ?> "> <div class="trackamount" display_items="0"> <div class="trackdisplay">$<?php
$accumulation = $endAccum; if ($choice_number >= $startAccum && $choice_number < $endAccum) { $winner_id = $user_chance->user_id; $winner_chance = $user_chance->percentage_chance * 100; } } } foreach ($user_chances as $user_chance) { query_addPotHistory($mysqli, $current_pot_id, $user_chance->user_id, $user_chance->user_value, $user_chance->percentage_chance * 100); } $result["already_chosen"] = false; $result["winner_id"] = $winner_id; $result["winner_chance"] = $winner_chance; $result["pot_empty"] = false; //if winner has csgobonanza.com in their name only take less %? query_getUserByUserID($mysqli, $pot_winner, $winner_id); $takePercent = 8; if (stripos($pot_winner["steam_name"], 'skinbonanza.com') !== false || stripos($pot_winner["steam_name"], 'skin bonanza.com') !== false) { $takePercent = 5; } $totalTakeAmount = $total_value * ($takePercent / 100); $leftTakeAmount = $totalTakeAmount; $house_items = array(); if (count($user_chances) > 1) { if (count($itemsList) > 0) { do { $closestDifference = PHP_INT_MAX; $closestIndex = -1; foreach ($itemsList as $item_key => $pot_item) { //TAKE ITEMS FOR THE HOUSE if ($pot_item->item_information["price"] < $leftTakeAmount) {
$this->tradeid = $tradeid; $this->user = $user; $this->items = $items; $this->type = $trade_type; $this->code = $trade_code; $this->status = $trade_status; $this->steamid = $trade_steam_id; } } query_getBotBySteamID($mysqli, $bot, $bot_steam_id); $trades = array(); query_getAllIncompleteTradesByBotID($mysqli, $db_trades, $bot["bot_id"]); if ($db_trades) { foreach ($db_trades as $db_trade) { if ($db_trade["trade_status"] == 0 || $db_trade["trade_status"] == 2 || $db_trade["trade_status"] == 9 || $db_trade["trade_status"] == 11) { query_getUserByUserID($mysqli, $user, $db_trade["user_id"]); query_getTradeItems($mysqli, $trade_items, $db_trade["trade_id"]); $items = array(); if ($trade_items) { foreach ($trade_items as $item) { array_push($items, $item["asset_id"]); } } $trade_url = $user["trade_token"]; $trade_parts = explode("=", $trade_url); $trade_token = $trade_parts[count($trade_parts) - 1]; $trade_user = new TradeUser($user["steam_id"], $trade_token); $trade = new Trade($db_trade["trade_id"], $trade_user, $items, $db_trade["trade_type"], $db_trade["trade_code"], $db_trade["trade_status"], $db_trade["trade_steam_id"]); array_push($trades, $trade); } }