-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.php
98 lines (79 loc) · 1.82 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
$id = str_replace("/", "", $_SERVER["QUERY_STRING"]);
$query = "http://steamcommunity.com/profiles/".$id."/inventory/json/730/2/";
$json = file_get_contents($query);
$data = json_decode($json, true);
if(!$data) {
$id = false;
exit();
}
$items = $data["rgDescriptions"];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $id ?>'s Profile</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
body {
background-color: #1b2838;
color: white;
font-family: "Open Sans";
text-align: center;
}
a {
color: inherit !important;
}
h1 {
text-align: center;
font-size: 4em;
}
strong {
font-size: 1.5em;
}
section#items {
width: 80%;
margin-left: 10%;
text-align: center;
background-color: rgba(0, 0, 0, 0.4);
box-shadow: 0 0 14px #030303 inset;
}
.item {
width: 18%;
margin: 5px;
transition: 0.2s opacity;
}
.item:hover {
opacity: 0.5;
}
.item.stattrack {
border: 5px solid orange;
border-radius: 5px;
}
</style>
</head>
<body>
<h1><strong><?php echo $id; ?></strong>'s Profile</h1>
<h4>Built by <a href="http://github.com/montyanderson">@montyanderson</a></h4>
<section id="items">
<?php
foreach($items as $item) {
$image_url = "http://cdn.steamcommunity.com/economy/image/";
if($item["icon_url_large"]) {
$image_url = $item["icon_url_large"];
} else {
$image_url = $item["icon_url"];
}
$hash = str_replace("+", "%20", urlencode($item["market_hash_name"]));
echo "<a href='http://steamcommunity.com/market/listings/730/$hash'>" . PHP_EOL;
echo "<img class='item";
if(substr($item["name"], 0, 4) == "Stat") echo " stattrack ";
echo "' src='http://cdn.steamcommunity.com/economy/image/$image_url' />";
echo "</a>" . PHP_EOL;
echo PHP_EOL;
}
?>
</section>
</body>
</html>