Beispiel #1
0
<?php

$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include_once "{$root}/../include/queries.php";
include_once "{$root}/../include/steam_openid.php";
include_once "{$root}/../include/config.php";
$api_key = file_get_contents("{$root}/../api_key.txt");
$open_id_validate = 0;
if (!empty($_GET['openid_assoc_handle'])) {
    $open_id_validate = SteamSignIn::validate();
}
$steam_open_id_url = SteamSignIn::genUrl();
if ($open_id_validate) {
    $_SESSION["steam_id"] = $open_id_validate;
    query_getUserBySteamID($mysqli, $user_id, $_SESSION["steam_id"]);
    $redirect_page = strtok($_SERVER['REQUEST_URI'], '?');
    if ($user_id == -1) {
        query_createUser($mysqli, $new_user_id, $_SESSION["steam_id"]);
        $_SESSION["user_id"] = $new_user_id;
        $redirect_page = "/profile/";
    } else {
        $_SESSION["user_id"] = $user_id;
    }
    $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];
Beispiel #2
0
                 foreach ($trade_items as $item) {
                     query_setItemWithdrawn($mysqli, $item["item_id"], 1);
                 }
                 $items_count = count($trade_items);
                 query_getBotBySteamID($mysqli, $bot, $_POST["bot_steam_id"]);
                 query_getBotItemCountByBotID($mysqli, $bot_item_count, $bot["bot_id"]);
                 $total_item_count = $bot_item_count - $items_count;
                 query_updateBotItemCount($mysqli, $bot["bot_id"], $total_item_count);
                 echo "completed";
             }
         }
     } else {
         if ($_POST["trade_status"] == 1 || $_POST["trade_status"] == 4 || $_POST["trade_status"] == 5 || $_POST["trade_status"] == 6 || $_POST["trade_status"] == 7 || $_POST["trade_status"] == 8 || $_POST["trade_status"] == 10 || $_POST["trade_status"] == 12 || $_POST["trade_status"] == 14 || $_POST["trade_status"] == 15 || $_POST["trade_status"] == 16 || $_POST["trade_status"] == 17 || $_POST["trade_status"] == 18) {
             query_getTradeItems($mysqli, $trade_items, $_POST["trade_id"]);
             if ($updated_trade["trade_type"] == "w") {
                 query_getUserBySteamID($mysqli, $user_id, $_POST["user_steam_id"]);
                 foreach ($trade_items as $item) {
                     query_returnFailedTradeItem($mysqli, $item["item_id"], $user_id);
                 }
             } else {
                 if ($updated_trade["trade_type"] == "d") {
                     $items_count = count($trade_items);
                     query_getBotBySteamID($mysqli, $bot, $_POST["bot_steam_id"]);
                     query_getBotItemCountByBotID($mysqli, $bot_item_count, $bot["bot_id"]);
                     $total_item_count = $bot_item_count - $items_count;
                     query_updateBotItemCount($mysqli, $bot["bot_id"], $total_item_count);
                 }
             }
         }
     }
 }