60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
include "includes/security.php";
|
|
|
|
checkPost();
|
|
|
|
$_SESSION["nome"] = $_POST["nome"];
|
|
$_SESSION["sesso"] = $_POST["sesso"];
|
|
|
|
if (!isset($_COOKIE["votiFemminili"])) {
|
|
setcookie("votiFemminili", 0, time() + 60 * 60 * 24 * 30);
|
|
}
|
|
|
|
if (!isset($_COOKIE["votiMaschili"])) {
|
|
setcookie("votiMaschili", 0, time() + 60 * 60 * 24 * 30);
|
|
}
|
|
?>
|
|
<!DOCTYPE HTML>
|
|
<html lang="it">
|
|
|
|
<head>
|
|
<title>Login</title>
|
|
<?php require "includes/head.php"; ?>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<h1>Vota Atleti</h1>
|
|
<h2>Ciao <?php echo $_SESSION["nome"]; ?></h2>
|
|
<form action="thanks.php" method="post">
|
|
<?php
|
|
$nomi = [];
|
|
if ($_POST["sesso"] == "m") {
|
|
$nomi = ["Pellegrini", "Egonu", "Vio"];
|
|
} else {
|
|
$nomi = ["Totti", "Tamberi", "Rossi"];
|
|
}
|
|
|
|
foreach ($nomi as $nome) {
|
|
echo '<div class="mb-3">';
|
|
echo '<label for="voto_' .
|
|
$nome .
|
|
'" class="form-label">' .
|
|
$nome .
|
|
"</label>";
|
|
echo '<input type="number" class="form-control" id="voto_' .
|
|
$nome .
|
|
'" name="voto_' .
|
|
$nome .
|
|
'" min="1" max="10">';
|
|
echo "</div>";
|
|
}
|
|
?>
|
|
<button type="submit" class="btn btn-primary">Invia voti</button>
|
|
</form>
|
|
</div>
|
|
|
|
<?php require "includes/footer.php"; ?>
|
|
|
|
</body>
|
|
</html>
|