-
Notifications
You must be signed in to change notification settings - Fork 2
/
mutual_view.php
667 lines (520 loc) · 24.5 KB
/
mutual_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
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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
<style>
.danger {
background-color: #f7a7a3;
border-left: 5px solid #8f130c;
width: 50%;
margin: 20px auto;
padding: 30px;
position: relative;
border-radius: 5px;
box-shadow: 0 0 15px 5px #ccc;
}
</style>
<?php
/**
* USERS CAN ARRIVE HERE BY CLICKING ON THE MUTUAL VIEW BUTTON ON THE PROFILE OF OTHER USERS. SHOWS THE COMMON MEDIA ITEMS MUTUAL TO BOTH THE USERS.
*
* @version PHP 8.0.12
* @since June 2022
* @author AtharvaShah
*/
session_start();
if (empty($_SESSION)) {
header("Location: login.php");
}
require "connection.php";
require "functions.php";
require "header.php";
$user_data = check_login($con);
if (isset($_GET['user_name'])) {
$otheruser = mysqli_real_escape_string($con, $_GET['user_name']);
$me = $user_data['user_name'];
// if otheruser name is passed as the logged in username show error
if ($otheruser == $me) {
echo "<div class='danger'><h3>You cannot view your own mutual media</h3></div>";
die();
}
// to check whether the other username exists or not
$query = "select * from `users` where `user_name`='$otheruser'";
$result = mysqli_query($con, $query);
$rowcount = mysqli_num_rows($result);
//echo error if does not exist
if ($rowcount != 1) {
echo ("<div class='danger'><h3>No Such User Exists</h3></div>");
die();
}
}
//echo error if NO username is passed
else {
echo ("<div class='danger'><h3>You must mention a username</h3></div>");
die();
}
//to show in the animated progress/color wheel
function determineColor($value)
{
$color = "";
if (($value >= 0) && ($value <= 15)) {
$color = "red";
} else if (($value > 15) && ($value <= 30)) {
$color = "orange";
} else if (($value > 30) && ($value <= 45)) {
$color = "yellow";
} else if (($value > 45) && ($value <= 60)) {
$color = "blue";
} else if (($value > 60) && ($value <= 80)) {
$color = "green";
} else if (($value > 80) && ($value <= 100)) {
$color = "darkgreen";
}
return $color;
}
//to get the number of rows returned by any query
function SQLGetCount($con, $sql)
{
if ($query = mysqli_query($con, $sql)) {
return mysqli_num_rows($query);
} else {
return 0;
}
}
//count of media items for the logged in user
$videogamecount_me = SQLGetCount($con, "SELECT DISTINCT videogame FROM data WHERE username='$me' AND videogame != ''");
$moviecount_me = SQLGetCount($con, "SELECT DISTINCT movie FROM data WHERE username='$me' AND movie != ''");
$musiccount_me = SQLGetCount($con, "SELECT DISTINCT album FROM data WHERE username='$me' AND album != ''");
$bookcount_me = SQLGetCount($con, "SELECT DISTINCT book FROM data WHERE username='$me' AND book != ''");
$tvcount_me = SQLGetCount($con, "SELECT DISTINCT tv FROM data WHERE username='$me' AND tv != ''");
//count of media items for the other user
$videogamecount_other = SQLGetCount($con, "SELECT DISTINCT videogame FROM data WHERE username='$otheruser' AND videogame!=''");;
$moviecount_other = SQLGetCount($con, "SELECT DISTINCT movie FROM data WHERE username='$otheruser' AND movie!=''");;
$musiccount_other = SQLGetCount($con, "SELECT DISTINCT album FROM data WHERE username='$otheruser' AND album!=''");
$bookcount_other = SQLGetCount($con, "SELECT DISTINCT book FROM data WHERE username='$otheruser' AND book!=''");;
$tvcount_other = SQLGetCount($con, "SELECT DISTINCT tv FROM data WHERE username='$otheruser' AND tv!=''");;
//MUTUAL VIDDEOGAMES
$videogamecount_mutual = SQLGetCount(
$con,
"SELECT LOWER(videogame) FROM data WHERE username='$me' AND videogame != ''
INTERSECT
SELECT LOWER(videogame) FROM data WHERE username='$otheruser' AND videogame != ''"
);
//MUTUAL MOVIES
$moviecount_mutual = SQLGetCount(
$con,
"SELECT LOWER(movie) , year FROM data WHERE username='$me' AND movie!=''
INTERSECT
SELECT LOWER(movie) , year FROM data WHERE username='$otheruser' AND movie!=''"
);
//MUTUAL MUSIC
$musiccount_mutual = SQLGetCount(
$con,
"SELECT LOWER(album) , artist FROM data WHERE username='$me' AND album!='' AND artist!=''
INTERSECT
SELECT LOWER(album), artist FROM data WHERE username='$otheruser' AND album!='' AND artist!=''"
);
//MUTUAL BOOK
$bookcount_mutual = SQLGetCount(
$con,
"SELECT LOWER(book), author FROM data WHERE username='$me' AND book!='' AND author!=''
INTERSECT
SELECT LOWER(book), author FROM data WHERE username='$otheruser' AND book!='' AND author!=''"
);
//MUTUAL TV
$tvcount_mutual = SQLGetCount(
$con,
"SELECT tv FROM data WHERE username='$me' AND tv != ''
INTERSECT
SELECT tv FROM data WHERE username='$otheruser' AND tv != ''"
);
// TO PREVENT ZERO DIVISION ERROR
if ($videogamecount_other == 0) {
$videogamecount_other = 1;
}
if ($bookcount_other == 0) {
$bookcount_other = 1;
}
if ($musiccount_other == 0) {
$musiccount_other = 1;
}
if ($moviecount_other == 0) {
$moviecount_other = 1;
}
if ($tvcount_other == 0) {
$tvcount_other = 1;
}
//calculate mutal media percentage
$mutual_game_percentage = round(($videogamecount_mutual / $videogamecount_other) * 100);
$mutual_movie_percentage = round(($moviecount_mutual / $moviecount_other) * 100);
$mutual_music_percentage = round(($musiccount_mutual / $musiccount_other) * 100);
$mutual_book_percentage = round(($bookcount_mutual / $bookcount_other) * 100);
$mutual_tv_percentage = round(($tvcount_mutual / $tvcount_other) * 100);
//5th index stores the sum of total mutual medias
$total_mutual_media_count = get_mutual_media_count($me, $otheruser)[5];
?>
<!-------------------------------------------------------------------------------------
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">
<title>WYDRN - Mutual View</title>
<!--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">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<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/mutual_view.css" rel="stylesheet">
<link href="css/backToTop.css" rel="stylesheet">
</head>
<body><button onclick="topFunction()" id="BackToTopBtn" title="Go to top">⇑</button>
<div class="heading">
<h1><img src="images/Icons/mutualmedia.png" class='header-icon'> Mutual View<span>Media items you<?php echo (" & " . $otheruser) ?> have in common</span></h1>
</div>
<!------------------------------------------
SHOWING BUTTONS
--------------------------------------------->
<div class="media-item-div" id="mutualGenericBtn">
<h2 class="mutual-media-title"><?php echo ($total_mutual_media_count); ?>
<?php if ($total_mutual_media_count > 1) echo "Mutual Medias";
else echo "Mutual Media"; ?>
</h2><br>
<p style="font-size:150px;">
<a class="emoji-link" href="#mutualGameBtn">🎮</a>
<a class="emoji-link" href="#mutualMusicBtn">🎧</a>
<a class="emoji-link" href="#mutualBookBtn">📕</a>
<a class="emoji-link" href="#mutualMovieBtn">💿</a>
<a class="emoji-link" href="#mutualTVBtn">📺</a>
</p>
<h3 class="mutual-media-subtitle"></h3>
</div>
<!------------------------------------------
VIDEO GAMES SECTION
--------------------------------------------->
<div class="media-item-div" id="mutualGameBtn">
<!-- CIRCULAR ANIMATION -->
<div class="flex-wrapper">
<!--DISPLAY WATCHED X/Y COUNT WHERE X = YOUR MEDIA AND Y=THEIR MEDIA-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart black">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="100, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="mutual-items-count">
<?php echo $videogamecount_mutual ?>/<?php echo $videogamecount_other ?>
</text>
</svg>
</div>
<div class="single-chart">
<h2 class="mutual-media-title">GAMES</h2>
<p class="emoji">🎮 </p>
</div>
<!--DISPLAY PERCENTAGE-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart <?php echo determineColor($mutual_game_percentage) ?>">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="<?php echo $mutual_game_percentage ?>, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="percentage">
<?php echo $mutual_game_percentage ?>%
</text>
</svg>
</div>
</div>
</div>
<center>
<div class="media" id="mutualGameDiv" style="display:none;">
<!--TO SHOW THE MEDIA ITEMS-->
<div class="mediaGrid">
<?php
$sql = "SELECT videogame FROM data WHERE username='$me' AND videogame != ''
INTERSECT
SELECT videogame FROM data WHERE username='$otheruser' AND videogame != ''";
if ($query = mysqli_query($con, $sql)) {
if (mysqli_num_rows($query) > 0) {
while ($row = mysqli_fetch_assoc($query)) {
$videogame = $row['videogame'];
?>
<div class="mediaContent">
<?php echo ucwords(strtolower($videogame)); ?>
</div>
<?php }
} else {
?>
<!--NO COMMON VIDEOGAMES MESSAGE-->
<div class="zero-media"><img src='images/Icons/Videogame.svg' width='15' height='15' class='media-icon'> No common videogames between <b>you</b> and <b><?php echo $otheruser; ?></b></div>
<?php }
}
?>
</div>
</div>
</center>
<!------------------------------------------
ALBUMS SECTION
--------------------------------------------->
<div class="media-item-div" id="mutualMusicBtn">
<!-- CIRCULAR ANIMATION -->
<div class="flex-wrapper">
<!--DISPLAY WATCHED X/Y COUNT WHERE X = YOUR MEDIA AND Y=THEIR MEDIA-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart black">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="100, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="mutual-items-count">
<?php echo $musiccount_mutual ?>/<?php echo $musiccount_other ?>
</text>
</svg>
</div>
<div class="single-chart">
<h2 class="mutual-media-title">ALBUMS</h2>
<p class="emoji">🎧</p>
</div>
<!--DISPLAY PERCENTAGE-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart <?php echo determineColor($mutual_music_percentage) ?>">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="<?php echo $mutual_music_percentage ?>, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="percentage">
<?php echo $mutual_music_percentage ?>%
</text>
</svg>
</div>
</div>
</div>
<center>
<div class="media" id="mutualMusicDiv" style="display:none;">
<!--TO SHOW THE MEDIA ITEMS-->
<div class="mediaGrid">
<?php
$sql = "SELECT album, artist FROM data WHERE username='$me' AND album!='' AND artist!=''
INTERSECT
SELECT album, artist FROM data WHERE username='$otheruser' AND album!='' AND artist!=''";
if ($query = mysqli_query($con, $sql)) {
if (mysqli_num_rows($query) > 0) {
while ($row = mysqli_fetch_assoc($query)) {
$album = $row['album'];
?>
<div class="mediaContent">
<?php echo ucwords(strtolower($album)); ?>
</div>
<?php
}
} else {
?>
<!--NO COMMON ALBUMS MESSAGE-->
<div class="zero-media"><img src='images/Icons/Music.svg' width='15' height='15' class='media-icon'> No common music between <b>you</b> and <b><?php echo $otheruser; ?></b></div>
<?php
}
}
?>
</div>
</div>
</center>
<!------------------------------------------
BOOKS SECTION
--------------------------------------------->
<div class="media-item-div" id="mutualBookBtn">
<!-- CIRCULAR ANIMATION -->
<div class="flex-wrapper">
<!--DISPLAY WATCHED X/Y COUNT WHERE X = YOUR MEDIA AND Y=THEIR MEDIA-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart black">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="100, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="mutual-items-count">
<?php echo $bookcount_mutual ?>/<?php echo $bookcount_other ?>
</text>
</svg>
</div>
<div class="single-chart">
<h2 class="mutual-media-title">BOOKS</h2>
<p class="emoji">📕</p>
</div>
<!--DISPLAY PERCENTAGE-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart <?php echo determineColor($mutual_book_percentage) ?>">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="<?php echo $mutual_book_percentage ?>, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="percentage">
<?php echo $mutual_book_percentage ?>%
</text>
</svg>
</div>
</div>
</div>
<center>
<div class="media" id="mutualBookDiv" style="display:none;">
<!--TO SHOW THE MEDIA ITEMS-->
<div class="mediaGrid">
<?php
$sql = "SELECT book, author FROM data WHERE username='$me' AND book!='' AND author!=''
INTERSECT
SELECT book, author FROM data WHERE username='$otheruser' AND book!='' AND author!=''";
if ($query = mysqli_query($con, $sql)) {
if (mysqli_num_rows($query) > 0) {
while ($row = mysqli_fetch_assoc($query)) {
$book = $row['book']; ?>
<div class="mediaContent">
<?php echo ucwords(strtolower($book)); ?>
</div>
<?php
}
} else {
?>
<!--NO COMMON BOOKS MESSAGE-->
<div class="zero-media"><img src='images/Icons/Book.svg' width='15' height='15' class='media-icon'> No common books between <b>you</b> and <b><?php echo $otheruser; ?></b></div>
<?php
}
}
?>
</div>
</div>
</center>
<!------------------------------------------
MOVIES SECTION
--------------------------------------------->
<div class="media-item-div" id="mutualMovieBtn">
<!-- CIRCULAR ANIMATION -->
<div class="flex-wrapper">
<!--DISPLAY WATCHED X/Y COUNT WHERE X = YOUR MEDIA AND Y=THEIR MEDIA-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart black">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="100, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="mutual-items-count">
<?php echo $moviecount_mutual ?>/<?php echo $moviecount_other ?>
</text>
</svg>
</div>
<div class="single-chart">
<h2 class="mutual-media-title">MOVIES</h2>
<p class="emoji">💿</p>
</div>
<!--DISPLAY PERCENTAGE-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart <?php echo determineColor($mutual_movie_percentage) ?>">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="<?php echo $mutual_movie_percentage ?>, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="percentage">
<?php echo $mutual_movie_percentage ?>%
</text>
</svg>
</div>
</div>
</div>
<center>
<div class="media" id="mutualMovieDiv" style="display:none;">
<!--TO SHOW THE MEDIA ITEMS-->
<div class="mediaGrid">
<?php
$sql = "SELECT movie, year FROM data WHERE username='$me' AND movie!='' AND year!=''
INTERSECT
SELECT movie, year FROM data WHERE username='$otheruser' AND movie!='' AND year!=''";
if ($query = mysqli_query($con, $sql)) {
if (mysqli_num_rows($query) > 0) {
while ($row = mysqli_fetch_assoc($query)) {
$movie = $row['movie'];
?>
<div class="mediaContent">
<?php echo ucwords(strtolower($movie)); ?>
</div>
<?php
}
} else {
?>
<!--NO COMMON MOVIES MESSAGE-->
<div class="zero-media"><img src='images/Icons/Movie.svg' width='15' height='15' class='media-icon'> No common movies between <b>you</b> and <b><?php echo $otheruser; ?></b></div>
<?php
}
}
?>
</div>
</div>
</center>
<!------------------------------------------
TV SERIES SECTION
--------------------------------------------->
<div class="media-item-div" id="mutualTVBtn">
<!-- CIRCULAR ANIMATION -->
<div class="flex-wrapper">
<!--DISPLAY WATCHED X/Y COUNT WHERE X = YOUR MEDIA AND Y=THEIR MEDIA-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart black">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="100, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="mutual-items-count">
<?php echo $tvcount_mutual ?>/<?php echo $tvcount_other ?>
</text>
</svg>
</div>
<div class="single-chart">
<h2 class="mutual-media-title">TV</h2>
<p class="emoji">📺 </p>
</div>
<!--DISPLAY PERCENTAGE-->
<div class="single-chart">
<svg viewBox="0 0 36 36" class="circular-chart <?php echo determineColor($mutual_tv_percentage) ?>">
<path class="circle-bg" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<path class="circle" stroke-dasharray="<?php echo $mutual_tv_percentage ?>, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
<text x="18" y="20.35" class="percentage">
<?php echo $mutual_tv_percentage ?>%
</text>
</svg>
</div>
</div>
</div>
<center>
<div class="media" id="mutualTVDiv" style="display:none;">
<!--TO SHOW THE MEDIA ITEMS-->
<div class="mediaGrid">
<?php
$sql = "SELECT tv FROM data WHERE username='$me' AND tv != ''
INTERSECT
SELECT tv FROM data WHERE username='$otheruser' AND tv != ''";
if ($query = mysqli_query($con, $sql)) {
if (mysqli_num_rows($query) > 0) {
while ($row = mysqli_fetch_assoc($query)) {
$tv = $row['tv'];
?>
<div class="mediaContent">
<?php echo ucwords(strtolower($tv)); ?>
</div>
<?php
}
} else {
?>
<!--NO COMMON TV SHOWS MESSAGE-->
<div class="zero-media"><img src='images/Icons/TV.svg' width='15' height='15' class='media-icon'> No common TV Shows between <b>you</b> and <b><?php echo $otheruser; ?></b></div>
<?php
}
}
mysqli_close($con);
?>
</div>
</div>
</center>
<!----------------------------------------------------------------------
JAVASCRIPT PART
------------------------------------------------------------------------>
<script>
//USING JQUERY, SELECT
$(document).ready(function() {
//clicking the media div will toggle the associated div with a slide animation.
$("#mutualGameBtn").click(function() {
$("#mutualGameDiv").slideToggle("slow");
});
$("#mutualMusicBtn").click(function() {
$("#mutualMusicDiv").slideToggle("slow");
});
$("#mutualBookBtn").click(function() {
$("#mutualBookDiv").slideToggle("slow");
});
$("#mutualMovieBtn").click(function() {
$("#mutualMovieDiv").slideToggle("slow");
});
$("#mutualTVBtn").click(function() {
$("#mutualTVDiv").slideToggle("slow");
});
});
</script>
<script src="js/backToTop.js"></script>
</body>
</html>