-
Notifications
You must be signed in to change notification settings - Fork 2
/
welcome.php
360 lines (287 loc) · 15.3 KB
/
welcome.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
<?php
/**
* PAGE WITH FORM THAT TAKES USER INPUT SUCH AS VIDEO GAMES, BOOKS, MOVIES, TV AND MUSIC AND SHOWS THE TOP MENU BAR WITH THE OPTIONS TO DELETE USER, EDIT PROFILE, SHARE PROFILE URL WITH FRIENDS AND LOGOUT. PAGE IS DIVIDED INTO TWO COLUMNS WHERE THE FORM TAKES THE LEFT HALF AND THE RIGHT HALF CONSISTS OF "WYDRN" DESCRIPTION AND USAGE GUIDELINES
* @version PHP 8.0.12
* @since June 2022
* @author AtharvaShah
*/
session_start();
require "connection.php";
require "functions.php";
require "header.php";
$user_data = check_login($con);
?>
<!------------------------------------------------------------------------------
HTML PART
------------------------------------------------------------------------------>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="lets users add medias as current status" />
<meta name="keywords" content="WYDRN, welcome" />
<title>WYDRN - Add Media</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="icon" type="image/png" href="images/website/favicons/favicon-32x32.png" sizes="32x32">
<link rel="apple-touch-icon" href="images/website/favicons/apple-touch-icon.png">
<link rel="stylesheet" href="CSS/welcome.css">
<link rel="stylesheet" href="SearchBoxAPIs/Videogame/main.css">
<link rel="stylesheet" href="SearchBoxAPIs/TV/main.css">
<link rel="stylesheet" href="SearchBoxAPIs/Movie/main.css">
<link rel="stylesheet" href="SearchBoxAPIs/Book/main.css">
<link rel="stylesheet" href="SearchBoxAPIs/Music/main.css">
<link href="css/backToTop.css" rel="stylesheet">
<!-- Sweet Alert (Beautiful looking alert plugin-->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
<body><button onclick="topFunction()" id="BackToTopBtn" title="Go to top">⇑</button>
<div class="page-wrapper p-t-180 p-b-100 font-poppins">
<div class="mywrapper mywrapper--w1200">
<form method="POST" action="profile.php" name="userinput" onsubmit="return Validation();">
<!------------------------------------------------------
Music
------------------------------------------------------>
<div class="card card-3">
<div class="card-heading" id="music-pic"></div>
<div class="card-body">
<h2 class="title">🎧 Add Albums </h2>
<div class="input-group">
<input type="text" class="input--style-3" name="Album" autofocus="true" placeholder="💿 Album Name" id="music-search-box" onkeyup="findAlbum()" onclick="findAlbum()" autocomplete="off">
</div>
<!--Reset Input Fields-->
<!-- <button type="button" class="resetField"><img src="images/Icons/clear.png" alt="Clear" onclick="clearInput('clear__music')"></button> -->
<div class="input-group">
<input type="text" class="input--style-3" name="Artist" placeholder="👩🎤 Artist" id="music-artist" readonly autocomplete="off"><br>
</div>
</div>
</div>
<div class="search-list-music" id="search-list-music">
<!--ALBUM SUGGESTIONS WILL APPEAR HERE-->
</div>
<!------------------------------------------------------
Books
------------------------------------------------------>
<div class="card card-3">
<div class="card-heading" id="book-pic"></div>
<div class="card-body">
<h2 class="title">📕 Add Books</h2>
<div class="input-group">
<input type="text" name="Book" class="input--style-3" placeholder="📖 Book" id="book-search-box" onkeyup="findBook()" onclick="findBook()" autocomplete="off"><br>
</div>
<div class="input-group">
<input type="text" class="input--style-3" name="Author" placeholder="✍🏻 Author" id="book-author" readonly autocomplete="off"><br>
</div>
</div>
</div>
<div class="search-list-books" id="search-list-book">
<!--BOOK SUGGESTIONS WILL APPEAR HERE-->
</div>
<!------------------------------------------------------
Movies
------------------------------------------------------>
<div class="card card-3">
<div class="card-heading" id="movie-pic"></div>
<div class="card-body">
<h2 class="title">📽 Add Movies</h2>
<div class="input-group">
<input type="text" class="input--style-3" name="Movie" placeholder="🍿 Movie Name" id="movie-search-box" onkeyup="findMovies()" onclick="findMovies()" autocomplete="off"><br>
</div>
<div class="input-group">
<input type="text" class="input--style-3" name="MovieRelease" placeholder="📅 Release Year" id="movie-year" readonly autocomplete="off"><br>
</div>
</div>
</div>
<div class="search-list-movies" id="search-list-movies">
<!--MOVIE SUGGESTIONS WILL APPEAR HERE-->
</div>
<!------------------------------------------------------
TV
------------------------------------------------------>
<div class="card card-3">
<div class="card-heading" id="tv-pic"></div>
<div class="card-body">
<h2 class="title">📺 Add TV Shows</h2>
<div class="input-group">
<input type="text" class="input--style-3" name="TV" placeholder="🖥️ Show Name" id="tv-search-box" onkeyup="findTV()" onclick="findTV()" autocomplete="off">
</div>
<select class="input--style-3" name="StreamPlatform" id="tv-network"><br>
<option value="" selected disabled hidden>📡 Network</option>
<option class="option-text" value="Netflix">Netflix</option>
<option class="option-text" value="Hulu">Hulu</option>
<option class="option-text" value="Amazon Prime">Amazon Prime</option>
<option class="option-text" value="HBO Max">HBO Max</option>
<option class="option-text" value="Disney+">Disney+</option>
<option class="option-text" value="Tencent Video">Tencent Video</option>
<option class="option-text" value="YouTube">YouTube Premium</option>
<option class="option-text" value="Peacock">Peacock</option>
<option class="option-text" value="Paramount+">Paramount+</option>
<option class="option-text" value="Discovery+">Discovery+</option>
</select>
</div>
</div>
<div class="search-list-tv" id="search-list-tv">
<!--MOVIE SUGGESTIONS WILL APPEAR HERE-->
</div>
<!-------------------------------------------------
Video Games
--------------------------------------------------->
<div class="card card-3">
<div class="card-heading" id="videogame-pic"></div>
<div class="card-body">
<h2 class="title">🎮 Add Videogames </h2>
<div class="input-group">
<input class="input--style-3" type="text" name="Videogame" placeholder="🎮 Videogame Name" id="game-search-box" onkeyup="findgame()" onclick="findgame()" autocomplete="off"><br>
</div>
<select class="input--style-3" name="Platform" id="game-platform">
<option value="" selected disabled hidden>🕹️ Platform</option>
<option class="option-text" value="PC">PC</option>
<option class="option-text" value="Xbox">Xbox</option>
<option class="option-text" value="Playstation">Playstation</option>
<option class="option-text" value="Nintendo">Nintendo Switch</option>
<option class="option-text" value="Wii">Wii</option>
</select>
</div>
</div>
<div class="search-list-games" id="search-list-games">
<!--VIDEOGAME SUGGESTIONS WILL APPEAR HERE-->
</div>
<!-- Add media button -->
<div class="text-center mb-lg-3">
<button type="submit" class="btn btn-outline-primary btn-light btn-lg" name="submit" value="btn1">Add Media</button>
</div>
</form>
</div>
</div>
<!--END OF MAIN BODY-->
<!------------------------------------------------------------------------
JAVASCRIPT PART
-------------------------------------------------------------------------->
<script src="SearchBoxAPIs/Music/script.js"></script>
<script src="SearchBoxAPIs/TV/script.js"></script>
<script src="SearchBoxAPIs/Movie/script.js"></script>
<script src="SearchBoxAPIs/Book/script.js"></script>
<script src="SearchBoxAPIs/Videogame/script.js"></script>
<script>
/**********************
* RESET SPECIFIC INPUTS
* *******************/
// function clearInput(x) {
// console.log('hi'+x);
// if (x == "clear__music") {
// document.getElementById("music-search-box").value = "";
// document.getElementById("music-artist").value = "";
// }
// }
/**********************
* VALIDATIONS
* *******************/
function Validation() {
let musicInput = document.getElementById("music-search-box").value;
let artistInput = document.getElementById("music-artist").value;
let bookInput = document.getElementById("book-search-box").value;
let authorInput = document.getElementById("book-author").value;
let movieInput = document.getElementById("movie-search-box").value;
let movieReleaseInput = document.getElementById("movie-year").value;
let tvInput = document.getElementById("tv-search-box").value;
let tvNetworkInput = document.getElementById("tv-network").value;
let gameInput = document.getElementById("game-search-box").value;
let gamePlatformInput = document.getElementById("game-platform").value;
if (musicInput != "") {
if (artistInput == "") {
swal({
title: "Artist Missing",
text: " Select an album from the dropdown list only.",
icon: "error",
button: "Retry",
});
return false;
}
}
if (bookInput != "") {
if (authorInput == "") {
swal({
title: "Author Missing",
text: " Select a book from the dropdown list only.",
icon: "error",
button: "Retry",
});
return false;
}
}
if (movieInput != "") {
if (movieReleaseInput == "") {
swal({
title: "Movie Year Missing",
text: " Select a movie from the dropdown list only.",
icon: "error",
button: "Retry",
});
return false;
}
}
if (tvInput != "") {
if (tvNetworkInput == "") {
swal({
title: "Select TV Network",
text: "You must choose a TV Show Network!",
icon: "error",
button: "Retry",
});
return false;
}
}
if (tvNetworkInput != "") {
if (tvInput == "") {
swal({
title: "Select TV Show",
text: "You must choose a TV Show from the dropdown!",
icon: "error",
button: "Retry",
});
return false;
}
}
if (gameInput != "") {
if (gamePlatformInput == "") {
swal({
title: "Select Game Platform",
text: "You must choose a Gaming Platform!",
icon: "error",
button: "Retry",
});
return false;
}
}
if (gamePlatformInput != "") {
if (gameInput == "") {
swal({
title: "Select Game",
text: "You must choose a Video Game from the dropdown!",
icon: "error",
button: "Retry",
});
return false;
}
}
//If all of the inputs are empty or some media types are filled partially, then the user will be alerted that they must fill in all the fields.
if ((musicInput && artistInput) || (bookInput && authorInput) || (movieInput && movieReleaseInput != "") || (tvInput && tvNetworkInput) || (gameInput && gamePlatformInput)) {
//add an alert here as well saying that profile is updated
return true;
} else {
//sweet alert plugin to display error message. IT REPLACES the JS alert() function.
swal({
title: "Log a Media",
text: "You must enter at least one media type!",
icon: "error",
button: "Retry",
});
return false;
}
}
</script>
<script src="js/backToTop.js"></script>
<?php mysqli_close($con); ?>
</body>
</html>