first commit
This commit is contained in:
commit
d975e212f9
35 changed files with 813 additions and 0 deletions
8
similverifica/includes/footer.php
Normal file
8
similverifica/includes/footer.php
Normal 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>
|
7
similverifica/includes/head.php
Normal file
7
similverifica/includes/head.php
Normal 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"
|
||||
/>
|
BIN
similverifica/includes/imgs/avengers.jpg
Normal file
BIN
similverifica/includes/imgs/avengers.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
similverifica/includes/imgs/napoleon.jpg
Normal file
BIN
similverifica/includes/imgs/napoleon.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
BIN
similverifica/includes/imgs/walle.jpg
Normal file
BIN
similverifica/includes/imgs/walle.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 99 KiB |
32
similverifica/includes/navbar.php
Normal file
32
similverifica/includes/navbar.php
Normal 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>
|
42
similverifica/includes/security.php
Normal file
42
similverifica/includes/security.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
session_start();
|
||||
$votes = json_decode(file_get_contents("votes.json"), true);
|
||||
function checkPost()
|
||||
{
|
||||
if (empty($_POST["nome"]) || empty($_POST["code"]) || empty($_POST["film"]) || empty($_POST["voto"])) {
|
||||
$_SESSION["error"] = true;
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (trim($_POST["code"]) !== "a123") {
|
||||
$_SESSION["error"] = true;
|
||||
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));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue