The following files exists in this folder. Click to view.
index.php75 lines UTF-8 Unix (LF) 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<?php
session_start();
if (!isset($_SESSION["userID"]))
header("location: login.php");
require_once "functions/database.php";
?>
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HogeNView</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
crossorigin="anonymous"></script>
<style>
.link-unchanged {
text-decoration: unset;
color: unset;
}
</style>
</head>
<body>
<?php include "page/navbar.php" ?>
<div class="container">
<br>
<h1>Dina filmkategorier</h1>
<br>
<?php
$data = $db->queryAll("SELECT c.* FROM allowedIDs a INNER JOIN category c ON a.categoryID = c.categoryID WHERE userID=:userID", array("userID" => $_SESSION["userID"]));
if($data == null){
echo '<h5 class="text-center" style="color: rgb(100,100,100)";>Du har inga tillgängliga filmer.</h5>';
}
$cardRowSize = 2;
function print_cell($data)
{
if (isset($data))
echo <<<EOD
<div class="col">
<a href="category.php?id={$data['categoryID']}" class="link-unchanged">
<div class="card">
<div class="card-body">
<h5 class="card-title">{$data["name"]}</h5>
<p class="card-text">{$data["description"]}</p>
</div>
</div>
</a>
</div>
EOD;
else
echo '<div class="col"></div>';
}
for ($row = 0; $row < ceil(sizeof($data) / $cardRowSize); $row++) {
echo '<div class="row">';
for ($col = 0; $col < $cardRowSize; $col++) {
if (isset($data[$row * $cardRowSize + $col]))
print_cell($data[$row * $cardRowSize + $col]);
else
print_cell(null);
}
echo '</div><br>';
}
?>
</div>
</body>
</html>