/
index.php
405 lines (309 loc) · 14.3 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<style type="text/css">
a:link { color: #FFFFFF; text-decoration: none}
a:visited { color: #FFFFFF; text-decoration: underline}
a:hover { color: #FFFFFF; text-decoration: underline}
a:active { color: #FFFFFF; text-decoration: underline}
#spectateButtonDiv {
//float:left;
//background-color:#FFFFFF;
//padding:5px;
height:24px;
}
#spectateButtonLeft {
float:left;
border:1px;
height:20px;
color:white;
border-radius:2px;
background: linear-gradient(to bottom, rgba(57, 163, 204, 1), rgba(33, 129, 190, 1));
cursor:pointer;
}
#spectateButtonRight {
float:right;
border:1px;
height:20px;
color:white;
border-radius:2px;
background: linear-gradient(to bottom, rgba(57, 163, 204, 1), rgba(33, 129, 190, 1));
cursor:pointer;
}
#closeInstrButton {
border:1px;
height:20px;
color:white;
border-radius:2px;
background: linear-gradient(to bottom, rgba(57, 163, 204, 1), rgba(33, 129, 190, 1));
}
#specInstr1 {
width:870px;
height:150px;
background:rgba(32,128,189,0.2);
color:#FFFFFF;
border:2px solid black;
border-radius:6px;
padding:20px;
display:none;
}
#specInstr2 {
width:870px;
height:150px;
background:rgba(32,128,189,0.2);
color:#FFFFFF;
border:2px solid black;
border-radius:6px;
padding:20px;
display:none;
}
#specRunTxt {
text-align:left;
width:850px;
height:29px;
resize:none;
background-color:#333333;
color:white;
font-size:11px;
}
#legal {
width:870px;
margin:0 auto;
font-size:12px;
}
#forms {
width:600px;
height:52px;
}
#mobileForms {
display:none;
height:200px;
}
#lineBreakDiv {
display:none;
}
#MainNavBar
{
font-size: 24px;
text-align: center;
list-style-type: none;
margin: 0;
padding: 0;
}
#NavBarLi
{
padding-right: 15px;
display: inline;
}
</style>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<LINK rel="stylesheet" type = "text/css"
href="homepage.css" media="screen">
<title>lolLookup</title>
</head>
<body>
<script>
function showDiv1() {
document.getElementById('specInstr1').style.display = "block";
}
function closeInstr1() {
document.getElementById('specInstr1').style.display = "none";
}
function showDiv2() {
document.getElementById('specInstr2').style.display = "block";
}
function closeInstr2() {
document.getElementById('specInstr2').style.display = "none";
}
</script>
<center><img src="/BackgroundImageBro/lollookup115.png" id="desktopLogo"></center>
<hr>
<ul id="MainNavBar">
<li id="NavBarLi"><a href="index.php">Home</a></li>
<li id="NavBarLi"><a href="playerProfile.php?summoner_name=">Profile Lookup</a></li>
<li id="NavBarLi"><a href="aboot.html">About Us</a></li>
</ul>
<br><br>
<! -- DESKTOP Input Forms (Hidden on Mobile) -- >
<center>
<div id="forms">
<span id="HeaderText"><span id="LargeText1">Game Lookup</span>
<form action="getCurrentGameInfo.php" method="post">
<input name="summonerName" id="textInput" placeholder="Summoner Name"/>
<input type="submit" name="submitButton" value="Submit" id="submitButton"/>
</form>
</span>
<span id="HeaderText2"><span id="LargeText2">Profile Lookup</span>
<form action="playerProfile.php?" method="get">
<input name="summoner_name" id="textInput" placeholder="Summoner Name"/>
<input type ="submit" value="Submit" id="submitButton"/>
</form>
</span>
</div>
</center>
<! -- MOBILE Input Forms (Hidden on Desktop) -- >
<center>
<div id="mobileForms">
<span id="mobileLargeText">Game Lookup</span>
<form action="getCurrentGameInfo.php" method="post">
<input name="summonerName" id="textInput" placeholder="Summoner Name"/>
<input type="submit" name="submitButton" value="Submit" id="submitButton"/>
</form>
<br>
<span id="mobileLargeText">Profile Lookup</span>
<form action="playerProfile.php?" method="get">
<input name="summoner_name" id="textInput" placeholder="Summoner Name"/>
<input type ="submit" value="Submit" id="submitButton"/>
</form>
</div>
</center>
<?php
include 'championList.php';
include 'summonerSpells.php';
function getJSONObj($url){
$curl = curl_init();
$options = [
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url
];
curl_setopt_array($curl, $options);
$JSONObj = json_decode(curl_exec($curl), true);
curl_close($curl);
return $JSONObj;
}
echo "<br><br>";
$FeatGames= getJSONObj('https://kr.api.pvp.net/observer-mode/rest/featured?api_key=****REDACTED****');
if($FeatGames){
//echo "<body>";
echo "<hr>";
echo "<br><br><br><center><div id=\"imageContainer\"><img src=\"/BackgroundImageBro/featuredgames1.png\" style=\"align:left;\"></div></center>";
echo "<center><div id=\"featGamesDiv\">";
echo "<div id=\"spectateButtonDiv\">";
echo "<button id=\"spectateButtonLeft\" onclick=\"showDiv1()\">Spectate</button>";
echo "<button id=\"spectateButtonRight\" onclick=\"showDiv2()\">Spectate</button>";
echo "</div>";
for($z = 0; $z < 2; $z++) {
$FeatGame= $FeatGames["gameList"][$z];
// Read the information about all of the summoners in that game, each summoner (10 total) becomes an
// element (object) in the $summoners array:
$summoners = array(
$FeatGame['participants'][0],
$FeatGame['participants'][1],
$FeatGame['participants'][2],
$FeatGame['participants'][3],
$FeatGame['participants'][4],
$FeatGame['participants'][5],
$FeatGame['participants'][6],
$FeatGame['participants'][7],
$FeatGame['participants'][8],
$FeatGame['participants'][9]
);
// Construct a string consisting of a comma separated list of all of the Summoner IDs in the current game
// (We get their IDs from the Summoner objects stored in the $summoners array)
// We now have all of the information we need to start constructing the content that the user will see.
// Begin by displaying the Game Mode at the top.
if($z == 0)
echo "<br><br><table id=\"curGameTable1\"><tr><th id=\"blue\"><b>Blue Team</b></th><th id=\"purple\"><b>Purple Team</b></th></tr>";
else
echo "<br><br><table id=\"tableRight\"><tr><th id=\"blue\"><b>Blue Team</b></th><th id=\"purple\"><b>Purple Team</b></th></tr>";
for ($i = 0; $i < 5; $i++) {
// Column - Blue Team Summoner
$summSpell1 = $spells[ (string) ($summoners[$i]['spell1Id']) ];
$summSpell2 = $spells[ (string) ($summoners[$i]['spell2Id']) ];
$championName = $champions[ (string)($summoners[$i]['championId']) ];
echo "<tr><td id=\"tdTierLeft\">";
echo "<img src=\"/champion_icons/" . str_replace(" ", "", str_replace(str_split(' '),"",$championName)) . ".png\" border=\"0\" title=\"" . $championName . "\" style=\"height:100%;width:auto;\">";
echo "<img src=\"/spell_icons/" . $summSpell1 . ".png\" border=\"1\" id=\"summSp1\" title=\"" . $summSpell1 . "\">";
echo "<img src=\"/spell_icons/" . $summSpell2 . ".png\" border=\"1\" id=\"summSp2\" title=\"" . $summSpell2 . "\">";
if($summoners[$i]['summonerName'] == $playerName){
echo "<span id=\"rankTextLeftYellow\"><a href=\"playerProfile.php?summoner_name=" . $summoners[$i]['summonerName'] . "\">" . $summoners[$i]['summonerName'] . "</a></span>";
}
else
echo "<span id=\"rankTextLeft\"><a href=\"playerProfile.php?summoner_name=" . $summoners[$i]['summonerName'] . "\">" . $summoners[$i]['summonerName'] . "</a></span>";
echo "</td>";
// Column - Role
echo "<td id=\"tdTierRight\">";
// Column - Purple Team Summoner
$summSpell1 = $spells[ (string) ($summoners[$i+5]['spell1Id']) ];
$summSpell2 = $spells[ (string) ($summoners[$i+5]['spell2Id']) ];
$championName = $champions[ (string)($summoners[$i+5]['championId']) ];
if($summoners[$i+5]['summonerName'] == $playerName){
echo "<span id=\"rankTextRightYellow\">" . $summoners[$i+5]['summonerName'] . "</span>";
}
else
echo "<span id=\"rankTextRight\"><a href=\"playerProfile.php?summoner_name=" . $summoners[$i+5]['summonerName'] . "\">" . $summoners[$i+5]['summonerName'] . "</a></span>";
echo "<img src=\"/spell_icons/" . $summSpell1 . ".png\" border=\"1\" id=\"summSp1Right\" title=\"" . $summSpell1 . "\">";
echo "<img src=\"/spell_icons/" . $summSpell2 . ".png\" border=\"1\" id=\"summSp2Right\" title=\"" . $summSpell2 . "\">";
echo "<img src=\"/champion_icons/" . str_replace(" ", "", str_replace(str_split(' '),"",$championName)) . ".png\" border=\"0\" title=\"" . $championName . "\" style=\"height:100%;width:auto;\">";
echo "</td></tr>";
}
echo "</table>";
}
echo "</div></center><br>";
echo "<center><div id=\"specInstr1\"><b>Spectate Instructions</b><br>";
echo "<br><div style=\"text-align:left;width:870px;\"><b>Windows</b>: Open the \"Run\" window by pressing '[Windows Key] + R', then paste in all of the following text:<br>";
echo "<br><center><textarea readonly id=\"specRunTxt\">" . "\"C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\\releases\\0.0.1.94\deploy\League of Legends.exe\" \"8394\" \"LoLLauncher.exe\" \"\" \"spectator spectator.na2.lol.riotgames.com:80 " . $FeatGames["gameList"][0]["observers"]["encryptionKey"] . " " . ((string)($FeatGames["gameList"][0]["gameId"])) . " " . "NA1\"" . "</textarea>";
echo "<br><br><button id=\"closeInstrButton\"onclick=\"closeInstr1()\">Close</button>";
echo "</center></div><br>";
echo "</div></center>";
echo "<center><div id=\"specInstr2\"><b>Spectate Instructions</b><br>";
echo "<br><div style=\"text-align:left;width:870px;\"><b>Windows</b>: Open the \"Run\" window by pressing '[Windows Key] + R', then paste in all of the following text:<br>";
echo "<br><center><textarea readonly id=\"specRunTxt\">" . "\"C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\\releases\\0.0.1.94\deploy\League of Legends.exe\" \"8394\" \"LoLLauncher.exe\" \"\" \"spectator spectator.na2.lol.riotgames.com:80 " . $FeatGames["gameList"][1]["observers"]["encryptionKey"] . " " . ((string)($FeatGames["gameList"][1]["gameId"])) . " " . "NA1\"" . "</textarea>";
echo "<br><br><button id=\"closeInstrButton\"onclick=\"closeInstr2()\">Close</button>";
echo "</center></div><br>";
echo "</div></center>";
}
$twitchStreams = getJSONObj('https://api.twitch.tv/kraken/streams?game=League+of+Legends');
if($twitchStreams){
echo "<br><br><br><center><div id=\"imageContainer\"><img src=\"/BackgroundImageBro/featuredstreams1.png\" style=\"align:left;\"></div></center>";
echo "<center><div id=\"sugItemsDiv\">";
for($j = 0; $j < 3; $j++){
$imgPreview = $twitchStreams["streams"][$j]["preview"]["small"];
$channelURL = $twitchStreams["streams"][$j]["channel"]["url"];
$channelName = $twitchStreams["streams"][$j]["channel"]["display_name"];
if(strlen($channelName) > 14) { $channelName = substr($channelName, 0, 13 ) . "..."; }
$viewers = (string) ($twitchStreams["streams"][$j]["viewers"]);
if($j == 0) { $margin = "streamLeft"; }
else { $margin = "streamRight"; }
echo "<a href=\"" . $channelURL . "\" target=\"_blank\">" . "<span id=\"" . $margin . "\"><img src=\"" . $imgPreview . "\"><span id=\"channelName\">" . $channelName . "</span><span id=\"numViewers\"><small><small>(" . $viewers . ")</small></small></span></span></a>";
}
echo "<br>";
for($j = 3; $j < 6; $j++){
$imgPreview = $twitchStreams["streams"][$j]["preview"]["small"];
$channelURL = $twitchStreams["streams"][$j]["channel"]["url"];
$channelName = $twitchStreams["streams"][$j]["channel"]["display_name"];
if(strlen($channelName) > 14) { $channelName = substr($channelName, 0, 13 ) . "..."; }
$viewers = (string) ($twitchStreams["streams"][$j]["viewers"]);
if($j == 3) { $margin = "streamLeft"; }
else { $margin = "streamRight"; }
echo "<a href=\"" . $channelURL . "\" target=\"_blank\">" . "<span id=\"" . $margin . "\" style=\"margin-top:28px\"><img src=\"" . $imgPreview . "\"><span id=\"channelName\">" . $channelName . "</span><span id=\"numViewers\"><small><small>(" . $viewers . ")</small></small></span></span></a>";
}
echo "<br>";
for($j = 6; $j < 9; $j++){
$imgPreview = $twitchStreams["streams"][$j]["preview"]["small"];
$channelURL = $twitchStreams["streams"][$j]["channel"]["url"];
$channelName = $twitchStreams["streams"][$j]["channel"]["display_name"];
if(strlen($channelName) > 14) { $channelName = substr($channelName, 0, 13 ) . "..."; }
$viewers = (string) ($twitchStreams["streams"][$j]["viewers"]);
if($j == 6) { $margin = "streamLeft"; }
else { $margin = "streamRight"; }
echo "<a href=\"" . $channelURL . "\" target=\"_blank\">" . "<span id=\"" . $margin . "\" style=\"margin-top:28px\"><img src=\"" . $imgPreview . "\"><span id=\"channelName\">" . $channelName . "</span><span id=\"numViewers\"><small><small>(" . $viewers . ")</small></small></span></span></a>";
}
echo "</div></center><br><br><br>";
}
?>
<br>
<hr>
<center><div id="legal"><font color="white">
<br>
<center>
All (Game, Profile, and Match) information is obtained via the Riot Games Developer API.
<br>
LoLLookup.com isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.
</center>
<br>
</font>
</div></center>
</body>
</html>