second commit

This commit is contained in:
Bildcraft1 2024-10-31 11:31:27 +01:00
parent d975e212f9
commit 12d8e33009
9 changed files with 266 additions and 0 deletions

View file

@ -0,0 +1,8 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
<script>
Fancybox.bind("[data-fancybox]", {
// Your custom options
});
</script>

View file

@ -0,0 +1,7 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css"
/>

View file

@ -0,0 +1,32 @@
<nav class="navbar navbar-expand-lg bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Facebook 2</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="amici.php">Amici</a>
</li>
<li class="nav-item">
<a class="nav-link" href="foto.php">Foto</a>
</li>
<li class="nav-item d-flex me-2">
<a class="nav-link" href="logout.php">Logout</a>
</li>
<?php
if (isset($_SESSION['admin']) && $_SESSION['admin']) {
echo '<li class="nav-item">
<a class="nav-link" href="upload.php">Admin</a>
</li>';
}
?>
</ul>
</div>
</div>
</nav>

View file

@ -0,0 +1,42 @@
<?php
session_start();
function checkPost()
{
unset($_SESSION["error"]);
if (empty($_POST["nome"]) || empty($_POST["eta"]) || empty($_POST["sesso"])) {
$_SESSION["error"] = "Dati mancanti";
}
if ($_POST["eta"] < 18) {
$_SESSION["error"] = "Devi avere 18 anni per entrare";
}
header("Location: login.php");
exit();
}
function checkSession()
{
if (empty($_SESSION["nome"]) || empty($_SESSION["code"]) || empty($_SESSION["film"]) || empty($_SESSION["voto"])) {
$_SESSION["error"] = true;
header("Location: login.php");
exit();
}
}
function checkHasVoted()
{
if (isset($_COOKIE["hasVoted"]) && $_COOKIE["hasVoted"]) {
$_SESSION["error"] = true;
return false;
}
return true;
}
function addVote($film, $vote)
{
global $votes;
$votes[$film] += $vote;
file_put_contents("votes.json", json_encode($votes));
}