Beispiel #1
0
<?php

include_once "db_connect.php";
include_once "queries.php";
session_start();
$mysqli->set_charset("utf8");
$price_api_key = file_get_contents("/var/sentora/hostdata/zadmin/pricing_key.txt");
$fetch_string = "http://backpack.tf/api/IGetMarketPrices/v1/?key=" . $price_api_key . "&appid=730";
$items_JSON_data = file_get_contents($fetch_string);
$items_data = json_decode($items_JSON_data);
if ($items_data->response->success == '1') {
    echo "API call worked, updating database. \r\n";
    $count = 0;
    foreach ($items_data->response->items as $id => $item) {
        $count++;
        echo $count . " - " . $id . "\r\n";
        query_getPriceDataID($mysqli, $price_data, $id);
        if ($price_data["price_id"] == null) {
            query_insertPriceData($mysqli, $id, $item->last_updated, $item->quantity, $item->value);
        } else {
            query_updatePriceDataByPriceID($mysqli, $price_data["price_id"], $item->last_updated, $item->quantity, $item->value);
        }
        $price = number_format($item->value / 100, 2, '.', ' ');
        query_updateItemPriceByHashName($mysqli, $id, $price);
    }
} else {
    echo "Pricing unsuccessful: " . $items_data->response->message . "\r\n";
}
echo 'Finished updating!';
sleep(20);
Beispiel #2
0
                        $quality_descriptor = $tag;
                    }
                }
            }
            if ($souvenir) {
                continue;
            }
            if ($item_info_array == null) {
                //by having this on the deposit page we guarantee that we have all the items in our database to speed up other pages
                query_addItemInformation_noPrice($mysqli, $item_data->classid, $description->market_hash_name, $description->icon_url, $rarity_descriptor->color, $quality_descriptor->color);
                $item_information_id = mysqli_insert_id($mysqli);
                //update the price from the pricing table
                query_getPriceDataID($mysqli, $price_data, $description->market_hash_name);
                if ($price_data != null) {
                    $price = number_format($price_data["value"] / 100, 2, '.', ' ');
                    query_updateItemPriceByHashName($mysqli, $description->market_hash_name, $price);
                    $item_info_array["price"] = $price;
                } else {
                    $item_info_array["price"] = '0';
                }
            }
            if (floatval($item_info_array["price"]) >= $global_info["item_price_min"] && floatval($item_info_array["price"]) <= $global_info["item_price_max"]) {
                ?>
								<div class="deposit_inventory_outer squareFromHeight deposit_inventory" item_name="<?php 
                echo $description->market_hash_name;
                ?>
" amount="<?php 
                echo $item_info_array["price"];
                ?>
" assetid="<?php 
                echo $item_data->id;