-
Notifications
You must be signed in to change notification settings - Fork 0
/
video.php
113 lines (107 loc) · 4.28 KB
/
video.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
<?php
session_start();
require('php/database.php');
//zoek de id in de url
$id = $_GET['id'];
if ($_SESSION['kanaalID'] == NULL){
$_SESSION['kanaalID'] = 0;
}
//query voor de om de video op te halen
?>
<!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>
</head>
<body class="bg-back">
<div class="d-flex">
<?php require("components/sidebar.php");?>
<div id="page-content-wrapper">
<?php require("components/navigation.php");?>
<div class="ml-3">
<?php
$query = "SELECT * FROM `video` WHERE `Video_ID` = ". $id;
//query om de kanaal te zoeken
//resultaat voor de video query
$result = mysqli_query($conn, $query);
$row = $result->fetch_assoc();
$queryKanaal = "SELECT * FROM kanaal WHERE Kanaal_ID =" . $row["KanaalID"] ;
//echo $result['KanaalID'];
//$queryKanaal = "SELECT * FROM kanaal WHERE Kanaal_ID = 15 ";
$foutmelding = "";
$path = 'uploads/videos/';
//checked of de url wel een id ontvangt en geen string
if ((int) $id === $id)
{
$foutmelding .= "<p>ERROR: You're trying to find a user by name! Not by ID.</p>";
echo $foutmelding;
}
if ($result)
{
//resultaat voor de kanaal query
$resultaat = mysqli_query($conn, $queryKanaal);
//checked of de resultaat goed is gegaan als het niet zo is dan krijg je een foutmelding
if (!$resultaat)
{
$foutmelding .= "<p>ERROR: Something went wrong trying to connect to the database.";
echo $foutmelding;
}
//loop over de resultaat voor van de resultaten.
foreach($resultaat as $kanaal)
{
?>
<?php
foreach($result as $video)
{
//query voor de video categorie
$queryC = "SELECT Naam FROM `categorie` WHERE Categorie_ID = ". $video['CategorieID'];
$resultC = mysqli_query($conn, $queryC);
$filename = $video['File'];
$filepath = $path.$filename;
$fileExtension = substr($filename, -3);
//echo de video titel
echo "<video autoplay style='width: 100%; height: auto; margin-top:2%;' poster='uploads/thumbnails/".$video['Thumbnail']."' muted controls>";
echo "<source src='".$filepath."' type='video/".$fileExtension."'>";
echo "Your browser doesn't support the video tag!";
echo "</video>";
echo "<div class='row justify-content-start'>
<a href='kanaal.php?id=". $kanaal['Kanaal_ID'] ."'><img class='img-fluid ml-1 rounded-circle' style='width: 70px; height: 70px;' src='uploads/profile/".$kanaal['ProfielPhoto']."' alt='Profilephoto for this channel'></a>
<a href='kanaal.php?id=". $kanaal['Kanaal_ID'] ."'><h2 class='text-white ml-2 mt-4'>".$kanaal['Naam']."</h2></a></div>";
echo "<div class='row mt-3 mx-auto'><h3 class='text-white'>".$video['Naam']."</h3>";
foreach($resultC as $catagorie)
{
//echo de categorie naam door de query
echo "<p class='text-white ml-2 mt-3'>".$catagorie['Naam']."</p>";
}
}
}
} else
{
$foutmelding .= "<p>ERROR: Something went wrong trying to connect to the database.";
echo $foutmelding;
}
?>
<div class="ml-3"><form action="php/subscribe.php" method="post">
<input type="hidden" name="kanaalID" value="<?php echo $kanaal['Kanaal_ID']; ?>">
<input type="submit" class="btn btn-outline-info" name="subscribe" value="Subscribe"></input>
</form></div>
<?php
if($kanaal['Kanaal_ID'] === $_SESSION['kanaalID']){
?><div class="ml-3"><form action="php/videoverwijder.php" method="post">
<input type="hidden" name="Kanaalid" value="<?php echo $kanaal['Kanaal_ID']; ?>">
<input type="hidden" name="VideoID" value="<?php echo $video['Video_ID']; ?>">
<input type="submit" class="btn btn-outline-info" name="verwijder" value="Verwijder Video"></input>
</form></div>
<?php }
?>
</div>
</div>
</div>
<?php require("components/comments.php");?>
</div>
<?php require("components/scripts.php");?>
</body>
</html>