-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
171 lines (163 loc) · 5.73 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
<?php
session_start();
//
// require('php/database.php');
//
// if (!isset($_SESSION['username']))
// {
//
// }
// else
// {
// $_SESSION['kanaalID'];
// $_SESSION['username'];
// $_SESSION['loggedin'] = true;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php require('components/head.php'); ?>
<title>Social Guys</title>
<style media="screen">
/* channels */
.channels{
display: flex;
position: absolute;
margin-left: 3rem;
margin-right: auto;
}
.channel{
margin-left: 1.5rem;
}
</style>
</head>
<body class="bg-back">
<div class="d-flex">
<?php require("components/sidebar.php");?>
<div id="page-content-wrapper">
<?php require("components/navigation.php");?>
<h2 style="margin-top: 1.2rem; text-align: center; color: #efeff1;">Your Top Recommended Video</h2>
<div id="myCarousel" class="ml-5 mr-5 mt-5 carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li></a>
</ol>
<div class="carousel-inner">
<?php
require('php/database.php');
if (!isset($_SESSION['username']))
{
?>
<div class="carousel-item active">
<a href="#">
<img class="img-fluid w-100" src="uploads/thumbnails/NoImage.jpg" alt="noimage">
<div class="container">
<div class="carousel-caption">
<a href="#" class="text-light"><h1>Cannot find any video's for your preference</h1>
<p>N/A</p></a>
</div>
</div>
</a>
</div>
<?php
}
else
{
$_SESSION['kanaalID'];
$_SESSION['username'];
$_SESSION['loggedin'] = true;
//krijg een id van het ingelogde kanaal
$kanaalID = $_SESSION['kanaalID'];
//SELECT views.VideoID, video.CategorieID FROM `views`, `video` WHERE video.CategorieID = 4 GROUP BY `VideoID` ORDER BY COUNT(*) DESC
//Query om de categorie van de kanaal te zoeken zodat er een recommended gemaakt kan worden.
$query = "SELECT `CategorieID` FROM `Kanaal` WHERE `Kanaal_ID` = ". $kanaalID;
$result = mysqli_query($conn, $query);
if ($result)
{
// output data of each row
while($row = mysqli_fetch_array($result))
{
$categorieID = $row['CategorieID'];
$topvid = "SELECT COUNT(VideoID), video.Video_ID, video.Naam, video.File, video.Thumbnail, video.CategorieID
FROM `video`, `views` WHERE video.CategorieID = '$categorieID' GROUP BY VideoID ASC LIMIT 1 ";
$resultaat = mysqli_query($conn, $topvid);
foreach($resultaat as $video)
{
//query voor de video categorie
$queryC = "SELECT Naam FROM `categorie` WHERE Categorie_ID = ". $video['CategorieID'];
$resultC = mysqli_query($conn, $queryC);
foreach ($resultC as $categorie)
{
?>
<div class="carousel-item active">
<a href="video.php/?id=<?php echo $video['Video_ID']; ?>">
<img class="img-fluid w-100" src="uploads/thumbnails/<?php echo $video['Thumbnail'] ?>" alt="<?php echo $video['Thumbnail']; ?>">
<div class="container">
<div class="carousel-caption">
<a href="video.php/?id=<?php echo $video['Video_ID']; ?>" class="text-light"><h1><?php echo $video['Naam']; ?></h1>
<p><?php echo $categorie['Naam']; ?></p></a>
</div>
</div>
</a>
</div>
<?php
}
}
}
} else
{
?>
<div class="carousel-item active">
<a href="#">
<img class="img-fluid w-100" src="uploads/thumbnails/NoImage.jpg" alt="noimage">
<div class="container">
<div class="carousel-caption">
<a href="#" class="text-light"><h1>Cannot find any video's for your preference</h1>
<p>N/A</p></a>
</div>
</div>
</a>
</div>
<?php
}
}
?>
</div>
<a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div class="channels">
<?php
$queryChannel = "SELECT Naam, Kanaal_ID, ProfielPhoto FROM kanaal LIMIT 6";
$resultChannel = mysqli_query($conn, $queryChannel);
if ($result)
{
foreach ($resultChannel as $channel)
{
?>
<div class="channel">
<a class="channel" href="kanaal.php?id=<?php echo $channel['Kanaal_ID']; ?>">
<img src="uploads/<?php echo $channel['ProfielPhoto']; ?>" class="img-fluid rounded-circle mx-auto" width='75px' height='75px'
alt="<?php echo $channel['ProfielPhoto']; ?>"> <no class="text-blank"><?php echo $channel['Naam']; ?></no>
</a>
</div>
<?php
}
}else
{
?> <h3>Can't find any channels</h3> <?php
}
?>
</div>
</div>
</div>
<?php require("components/scripts.php");?>
</body>
</html>