<?php
include('header.php');
?>
<table class="items">
<?
if($_SESSION['id']!=null) {
if($_POST['trade_id']!=null){
if(delete_lot($_SESSION['id'],$_POST['trade_id'])){
$message = "Лот удален";
}else{
$error = "Ошибка попробуйте еще раз...";
}
}
$get_content = file_get_contents($_SESSION['profile_url'] . "/inventory/json/730/2");
$data_image = (array)json_decode($get_content)->rgInventory;
$count_content = count($data_image);
$data_content = (array)json_decode($get_content, TRUE);
// $ooo = file_get_contents("http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?key=E2E30691732BDEA35D849AA034D974BA&appid=730&class_count=1&classid0=1388593620&language=ru");
echo "<tr><td id='thead'><p>Ваш инвентарь:</p><hr></td></tr>";
echo "<tr><td id='thead2'><p>Выберите предмет для продажи</p></td></tr>";
for ($i = 0; $i < $count_content; $i++) {
if (is_int($i / 9) == 0) "<tr>";
echo "<td class='item'>";
$element_name = array_shift($data_content[rgInventory]);
$name_item = "$element_name[classid]_$element_name[instanceid]";
echo "<a href='item.php?classid=".$element_name[classid]."'>";
echo "<img src='http://steamcommunity-a.akamaihd.net/economy/image/";
print_r($data_content['rgDescriptions'][$name_item]['icon_url']);
echo "' style='width:150px; height:120px;'></a>";
echo "</td>";
if (is_int($i / 9) == 0) echo "</tr>";
}
echo "<tr><td colspan='10'><hr></td></tr>";
echo "<tr><td colspan='10' id='tfoot'>Всего предметов: $count_content </td></tr>";
}else {
echo "<tr><td id='thead2' style='text-align:center;'><p>Войдите в Steam</p></td></tr>";
}
?>
</table>
<table class="items">
<?
if($_SESSION!=null) {
$lots = get_lots($_SESSION['id']);
$count_lots = count($lots);
echo "<tr><td id='thead'><p>Ваши лоты:</p><hr></td></tr>";
for ($i = 1; $i < $count_lots+1; $i++) {
if (($i%10) == 0) "<tr>";
echo "<td class='item'><form action='' method='post'>
<input type='hidden' name='trade_id' value='".$lots[$i-1][0]."'>";
$get_content = file_get_contents("http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?key=E2E30691732BDEA35D849AA034D974BA&appid=730&class_count=1&classid0=".$lots[$i-1][2]."&language=ru");
$data_image = (array)json_decode($get_content)->rgInventory;
$count_content = count($data_image);
$data_content = (array)json_decode($get_content, TRUE);
$item = $data_content['result'][$lots[$i-1][2]];
echo "<a style='width:150px; height:120px; background:url(\"http://steamcommunity-a.akamaihd.net/economy/image/".$item['icon_url']."\"); background-size:100% 100%; display:block;' href='buy.php?tradeid=".$lots[$i-1][0]."'>";
echo '<div class="upper_trade"><input class="delete_but" type="submit" value=""></div>';
echo '<div class="lower_trade">';
echo "<p>".$lots[$i-1][1]." руб.</p>";
echo "</div>";
echo '</a>';
echo "</td>";
if (($i%9) == 0) echo "</form></tr>";
}
echo "<tr><td colspan='10'><hr></td></tr>";
echo "<tr><td colspan='10' id='tfoot'>Всего предметов: $count_lots </td></tr>";
}else {
$error = "Войдите в Steam";
}
?>
</table>
<table class="items">
<?
if($_SESSION!=null) {
$lots = get_buys($_SESSION['id']);
$count_lots = count($lots);
echo "<tr><td id='thead'><p>Ожидают обмена:</p><hr></td></tr>";
for ($i = 1; $i < $count_lots+1; $i++) {
if (($i%10) == 0) "<tr>";
echo "<td class='item'><form action='' method='post'>
<input type='hidden' name='trade_id' value='".$lots[$i-1][0]."'>";
$get_content = file_get_contents("http://api.steampowered.com/ISteamEconomy/GetAssetClassInfo/v0001/?key=E2E30691732BDEA35D849AA034D974BA&appid=730&class_count=1&classid0=".$lots[$i-1][2]."&language=ru");
$data_image = (array)json_decode($get_content)->rgInventory;
$count_content = count($data_image);
$data_content = (array)json_decode($get_content, TRUE);
$item = $data_content['result'][$lots[$i-1][2]];
echo "<a style='width:150px; height:120px; background:url(\"http://steamcommunity-a.akamaihd.net/economy/image/".$item['icon_url']."\"); background-size:100% 100%; display:block;' href='offer.php?tradeid=".$lots[$i-1][0]."'>";
echo '<div class="upper_trade"></div>';
echo '<div class="lower_trade buys_1">';
echo "<p>Ожидание обмена</p>";
echo "</div>";
echo '</a>';
echo "</td>";
if (($i%9) == 0) echo "</form></tr>";
}
echo "<tr><td colspan='10'><hr></td></tr>";
echo "<tr><td colspan='10' id='tfoot'>Всего предметов: $count_lots </td></tr>";
}else {
$error = "Войдите в Steam";
}
?>
</table>
<?php if (isset($message) && $message != null) {
echo " <h3 id='error_nice_msg'>";
echo $message;
echo "</h3>";
} else {
if (isset($error) && $error != null) {
echo " <h3 id='error_warning_msg'>";
echo $error;
echo "</h3>";
}
} ?>
<?php
include('footer.php');
?>