-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmedia_list_view.php
306 lines (266 loc) · 10.2 KB
/
media_list_view.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
<?php
/**
* SHOWS NON-DUPLICATE BOOKS LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
*
* @version PHP 8.0.12
* @since August 2022
* @author AtharvaShah
*/
session_start();
if (empty($_SESSION)) {
header("Location: login.php");
}
require "header.php";
require "connection.php";
require "functions.php";
$user_data = check_login($con);
$username = $user_data['user_name'];
function bringLettersToFront($bkName){
if(substr($bkName, -5)==', THE'){
$bkName = 'The '.substr($bkName, 0, -5);
}
elseif(substr($bkName, -3)==', A'){
$bkName = 'A ' .substr($bkName, 0, -3);
}
return $bkName;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="list view of media added in the given categories" />
<meta name="keywords" content="WYDRN, media list view" />
<title>WYDRN - Media List View</title>
<link href="css/media_list_view.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!--Bootstrap Link-->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" 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 href="css/backToTop.css" rel="stylesheet">
</head>
<body>
<button onclick="topFunction()" id="BackToTopBtn" title="Go to top">⇑</button>
<?php
/****************
* TO DISPLAY BOOKS LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
*
* ******************/
if (isset($_GET['book'])) {
$sql = "SELECT `book`, `author`, `date` FROM `data` where book != '' and username='$username' GROUP BY `book`";
$result = mysqli_query($con, $sql);
if ($query = mysqli_query($con, $sql)) {
$totalcount = mysqli_num_rows($query);
if ($totalcount > 0) {
?>
<div class="backToGrid">
<a href="media_book.php"><img src="images/Icons/grid.png" height="30px" width="30px"></a>
</div>
<?php
$list = '
<div id="wrapper">
<table id="keywords" cellspacing="0" cellpadding="0" class="tablesorter">';
$list .= '<thead>
<tr>
<th><span>Book</span></th>
<th><span>Author</span></th>
<th><span>Logged On</span></th>
</tr>
</thead>';
while ($row = mysqli_fetch_assoc($query)) {
$book = strtoupper($row['book']);
$book= bringLettersToFront($book);
$author = strtoupper($row['author']);
$date = $row['date'];
$date = printable_date($date);
$list .= "<tr><td class='lalign'>$book</td><td>$author</td><td>$date</td></tr>";
}
$list .= ' </table>
</div> ';
echo $list;
} else {
//NO BOOKS LOGGED MESSAGE
$BooksNotAdded = "<br><center><div class='alert alert-danger w-50 text-center alert-dismissible fade show' role='alert'><img src='images/Icons/Book.svg' width='15' height='15' class='media-icon'> No books added to your account.<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div></center>";
echo $BooksNotAdded;
}
}
}
?>
<?php
/******************
* TO DISPLAY MOVIES LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
* ******************/
if (isset($_GET['movie'])) {
$sql = "SELECT `movie`, `year`, `date` FROM `data` where movie != '' and username='$username' GROUP BY `movie`";
$result = mysqli_query($con, $sql);
if ($query = mysqli_query($con, $sql)) {
$totalcount = mysqli_num_rows($query);
if ($totalcount > 0) {
?>
<div class="backToGrid">
<a href="media_movie.php"><img src="images/Icons/grid.png" height="30px" width="30px"></a>
</div>
<?php
$list = '<div id="wrapper">
<table id="keywords" cellspacing="0" cellpadding="0">';
$list .= '<thead>
<tr>
<th><span>Movie</span></th>
<th><span>Release Year</span></th>
<th><span>Logged On</span></th>
</tr>
</thead>';
while ($row = mysqli_fetch_assoc($query)) {
$movie = strtoupper($row['movie']);
$year = strtoupper($row['year']);
$date = $row['date'];
$date = printable_date($date);
$list .= "<tr><td class='lalign'>$movie</td><td>$year</td><td>$date</td></tr>";
}
$list .= ' </table>
</div> ';
echo $list;
} else {
//NO Movies LOGGED MESSAGE
$MovieNotAdded = "<br><center><div class='alert alert-danger w-50 text-center alert-dismissible fade show' role='alert'><img src='images/Icons/Movie.svg' width='15' height='15' class='media-icon'> No Movies added to your account.<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div></center>";
echo $MovieNotAdded;
}
}
}
?>
<?php
/******************
* TO DISPLAY TV SHOWS LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
* ******************/
if (isset($_GET['tv'])) {
$sql = "SELECT `tv`, `streaming`, `date` FROM `data` where tv != '' and username='$username' GROUP BY `tv`";
$result = mysqli_query($con, $sql);
if ($query = mysqli_query($con, $sql)) {
$totalcount = mysqli_num_rows($query);
if ($totalcount > 0) {
?>
<div class="backToGrid">
<a href="media_tv.php"><img src="images/Icons/grid.png" height="30px" width="30px"></a>
</div>
<?php
$list = '<div id="wrapper">
<table id="keywords" cellspacing="0" cellpadding="0">';
$list .= '<thead>
<tr>
<th><span>TV Show</span></th>
<th><span>Network</span></th>
<th><span>Logged On</span></th>
</tr>
</thead>';
while ($row = mysqli_fetch_assoc($query)) {
$tv = strtoupper($row['tv']);
$streaming = strtoupper($row['streaming']);
$date = $row['date'];
$date = printable_date($date);
$list .= "<tr><td class='lalign'>$tv</td><td>$streaming</td><td>$date</td></tr>";
}
$list .= ' </table>
</div> ';
echo $list;
} else {
//NO TV Shows LOGGED MESSAGE
$TVNotAdded = "<br><center><div class='alert alert-danger w-50 text-center alert-dismissible fade show' role='alert'><img src='images/Icons/TV.svg' width='15' height='15' class='media-icon'> No TV Shows added to your account.<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div></center>";
echo $TVNotAdded;
}
}
}
?>
<?php
/******************
* TO DISPLAY ALBUMS LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
* ******************/
if (isset($_GET['album'])) {
$sql = "SELECT `album`, `artist`, `date` FROM `data` where album != '' and username='$username' GROUP BY `album`";
$result = mysqli_query($con, $sql);
if ($query = mysqli_query($con, $sql)) {
$totalcount = mysqli_num_rows($query);
if ($totalcount > 0) {
?>
<div class="backToGrid">
<a href="media_music.php"><img src="images/Icons/grid.png" height="30px" width="30px"></a>
</div>
<?php
$list = '<div id="wrapper">
<table id="keywords" cellspacing="0" cellpadding="0">';
$list .= '<thead>
<tr>
<th><span>Album</span></th>
<th><span>Artist</span></th>
<th><span>Logged On</span></th>
</tr>
</thead>';
while ($row = mysqli_fetch_assoc($query)) {
$album = strtoupper($row['album']);
$artist = strtoupper($row['artist']);
$date = $row['date'];
$date = printable_date($date);
$list .= "<tr><td class='lalign'>$album</td><td>$artist</td><td>$date</td></tr>";
}
$list .= ' </table>
</div> ';
echo $list;
} else {
//NO Albums LOGGED MESSAGE
$AlbumNotAdded = "<br><center><div class='alert alert-danger w-50 text-center alert-dismissible fade show' role='alert'><img src='images/icons/Music.svg' width='15' height='15' class='media-icon'> No Albums added to your account.<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div></center>";
echo $AlbumNotAdded;
}
}
}
?>
<?php
/******************
* TO DISPLAY Videogames LOGGED BY THE USER IN A SINGLE PAGE TABULAR FORM.
* ******************/
if (isset($_GET['videogame'])) {
$sql = "SELECT `videogame`, `platform`, `date` FROM `data` where videogame != '' and username='$username' GROUP BY `videogame`";
$result = mysqli_query($con, $sql);
if ($query = mysqli_query($con, $sql)) {
$totalcount = mysqli_num_rows($query);
if ($totalcount > 0) {
?>
<div class="backToGrid">
<a href="media_videogame.php"><img src="images/Icons/grid.png" height="30px" width="30px"></a>
</div>
<?php
$list = '<div id="wrapper">
<table id="keywords" cellspacing="0" cellpadding="0">';
$list .= '<thead>
<tr>
<th><span>Videogame</span></th>
<th><span>Platform</span></th>
<th><span>Logged On</span></th>
</tr>
</thead>';
while ($row = mysqli_fetch_assoc($query)) {
$videogame = strtoupper($row['videogame']);
$platform = strtoupper($row['platform']);
$date = $row['date'];
$date = printable_date($date);
$list .= "<tr><td class='lalign'>$videogame</td><td>$platform</td><td>$date</td></tr>";
}
$list .= ' </table>
</div> ';
echo $list;
} else {
//NO Videogame LOGGED MESSAGE
$VideogameNotAdded = "<br><center><div class='alert alert-danger w-50 text-center alert-dismissible fade show' role='alert'><img src='images/icons/Videogame.svg' width='15' height='15' class='media-icon'> No Videogames added to your account.<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div></center>";
echo $VideogameNotAdded;
}
}
}
?>
</body>
<script src="js/backToTop.js"></script>
<script>
$(function() {
$('#keywords').tablesorter({ sortList: [[0,0], [1,0]] });
});
</script>
</html>