-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
227 lines (195 loc) · 6.23 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
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="keywords" content="League of Legends, Riot Games, LOL, MOBA">
<meta name="description" content="Share your League of Legends highlight videos or just watch other players' highlight videos!">
<title>Show off your League of Legends highlight videos! | LeagueLights</title>
<!-- Bootstrap core CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/shop-homepage.css" rel="stylesheet">
<link href="css/leaguelights.css" rel="stylesheet">
</head>
<body>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebApplication",
"name" : "LeagueLights",
"url" : "http://leaguelights.com",
"applicationCategory" : "multimedia",
"applicationSubCategory" : ["video streaming", "streaming media"],
"countriesSupported" : "North America",
"about" : "League of Legends",
"creator" : "https://www.linkedin.com/in/danielswcho/",
"isBasedOn" : "https://na.leagueoflegends.com/en/",
"operatingSystem" : ["Windows", "macOS", "Android"]
}
</script>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">LeagueLights</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<div class="navbar-nav ml-auto">
<li id="profile" class="nav-item ml-auto">
</li>
<li id="sign" class="navbar-nav ml-auto">
</li>
</div>
</div>
</div>
</nav>
<div class="container py-5">
<div class="row">
<!-- leaguelights logo will adjust its size depends on viw points -->
<div class="col d-none d-lg-block">
<img class="d-block mx-auto" src="img/leaguelights1024.png">
</div>
<div class="col d-none d-md-block d-lg-none">
<img class="d-block mx-auto" src="img/leaguelights512.png">
</div>
<div class="col d-md-none">
<img class="d-block mx-auto" src="img/leaguelights256.png">
</div>
</div>
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<form>
<div class="row">
<!-- searchKey will be used to find if a user with exact searchKey or video's title that contains searchKey exist-->
<input class="col-lg-7" type="text" name="searchKey" required>
<!--currently only north america server is available -->
<select class="col-lg-2" id="region" name="server">
<option>NA</option>
<!--<option>KR</option>
<option>BR</option>
<option>JP</option>
<option>EUNE</option>
<option>EUW</option>
<option>LAN</option>
<option>LAS</option>
<option>OCE</option>
<option>TR</option>
<option>RU</option>-->
</select>
<button class="col-lg-3" type="submit" name="submit" value="submit">Search</button>
</div>
<br>
</form>
</div>
</div>
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<h5 class="col-lg-12 text-center">
New? <a class="nav-link" href="signUp.php">Register</a> with your summoner name!
</h5>
</div>
</div>
</div>
<?php
//boolean to decide wheather to display link to logged in user's profile "My Lights" or not
$profileDisplay = false;
if(isset($_SESSION['currentId'])){
//if user is logged in, display sign out option and display "My Lights" button
$loggedInAs = $_SESSION['currentId'];
$signStatus = "Sign out";
//sign out link will pop up a new tab to confirm sign out
$href = "javascript:window.open('signOut.php','mywindowtitle','width=1000,height=400')";
$profileDisplay = true;
}else{
//if user is not logged in, display sign in
$signStatus = "Sign in";
$href = "login.php";
}
//link to search result with searchKey via get request
$url = "Location:searchResult.php?server=";
if (isset($_GET['submit'])) {
$searchKey = $_GET['searchKey'];
$server = $_GET['server'];
switch($server){
case "NA":
$url = $url."na1";
break;
/*
case "KR":
$url = $url."kr";
break;
case "EUNE":
$url = $url."eun1";
break;
case "EUW":
$url = $url."euw1";
break;
case "BR":
$url = $url."br1";
break;
case "JP":
$url = $url."jp1";
break;
case "LAN":
$url = $url."la1";
break;
case "LAS":
$url = $url."la2";
break;
case "OCE":
$url = $url."oc1";
break;
case "TR":
$url = $url."tr1";
break;
case "RU":
$url = $url."ru";
break;
*/
}
$url = $url."&keyword=".$searchKey;
header($url);
exit;
}
?>
<script>
window.onload = function() {
// sign in/out display and its corresponding link
var sign = "<?php echo $signStatus; ?>";
var signInfo = document.getElementById("sign");
var link = document.createElement("a");
link.setAttribute("href", "<?php echo $href; ?>");
link.setAttribute("class", "nav-link");
link.innerHTML = sign;
signInfo.appendChild(link);
//display "My Lights" and its link
if ("<?php echo $profileDisplay; ?>"){
var showProfile = document.getElementById("profile");
var profileAnchor = document.createElement("a");
profileAnchor.setAttribute("href", "profile.php");
profileAnchor.setAttribute("class", "nav-link");
profileAnchor.innerHTML = "My Lights";
showProfile.appendChild(profileAnchor);
}
}
</script>
<!-- Footer -->
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">Copyright © LeagueLights 2018</p>
</div>
<!-- /.container -->
</footer>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/popper/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>