formatting
This commit is contained in:
parent
ba05612a57
commit
6664acbdfe
4 changed files with 35 additions and 25 deletions
|
@ -7,21 +7,19 @@
|
|||
<td>Voto</td>
|
||||
</tr>
|
||||
<?php
|
||||
$voti = array("Piero"=>3, "Paolo"=>9, "Luca"=>7, "Roberto"=>3);
|
||||
$voti = ["Piero" => 3, "Paolo" => 9, "Luca" => 7, "Roberto" => 3];
|
||||
$media = 0;
|
||||
foreach($voti as $name => $voto){
|
||||
$media+= $voto;
|
||||
echo "<tr>
|
||||
foreach ($voti as $name => $voto) {
|
||||
$media += $voto;
|
||||
echo "<tr>
|
||||
<td>$name</td>
|
||||
<td>$voto</td>
|
||||
</tr>";
|
||||
}
|
||||
$media = $media / count($voti);
|
||||
?>
|
||||
}
|
||||
$media = $media / count($voti);
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
echo $media;
|
||||
?>
|
||||
<?php echo $media; ?>
|
||||
</body>
|
||||
</html>
|
|
@ -13,20 +13,19 @@ if (!isset($_COOKIE["votiFemminili"])) {
|
|||
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" ?>
|
||||
<?php require "includes/head.php"; ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Vota Atleti</h1>
|
||||
<h2>Ciao <?php echo $_SESSION["nome"] ?></h2>
|
||||
<h2>Ciao <?php echo $_SESSION["nome"]; ?></h2>
|
||||
<form action="thanks.php" method="post">
|
||||
<?php
|
||||
$nomi = [];
|
||||
|
@ -38,16 +37,24 @@ if (!isset($_COOKIE["votiMaschili"])) {
|
|||
|
||||
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>';
|
||||
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" ?>
|
||||
<?php require "includes/footer.php"; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
global $votes;
|
||||
include "includes/security.php";
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
|
@ -9,7 +8,7 @@ include "includes/security.php";
|
|||
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<?php require "includes/head.php" ?>
|
||||
<?php require "includes/head.php"; ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -21,7 +20,7 @@ include "includes/security.php";
|
|||
<canvas id='statisicheBrowser'></canvas>
|
||||
</div>
|
||||
|
||||
<?php require "includes/footer.php" ?>
|
||||
<?php require "includes/footer.php"; ?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<script>
|
||||
|
@ -35,7 +34,9 @@ include "includes/security.php";
|
|||
labels: ['Pellegrini', 'Egonu', 'Vio'],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [<?= $votes["voto_Pellegrini"] ?>, <?= $votes["voto_Egonu"] ?>, <?= $votes["voto_Vio"] ?>,],
|
||||
data: [<?= $votes["voto_Pellegrini"] ?>, <?= $votes[
|
||||
"voto_Egonu"
|
||||
] ?>, <?= $votes["voto_Vio"] ?>,],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
|
@ -55,7 +56,9 @@ include "includes/security.php";
|
|||
labels: ['Totti', 'Tamberi', 'Rossi'],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [<?= $votes["voto_Totti"] ?>, <?= $votes["voto_Tamberi"] ?>, <?= $votes["voto_Rossi"] ?>,],
|
||||
data: [<?= $votes["voto_Totti"] ?>, <?= $votes[
|
||||
"voto_Tamberi"
|
||||
] ?>, <?= $votes["voto_Rossi"] ?>,],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
|
@ -74,7 +77,9 @@ include "includes/security.php";
|
|||
labels: ['Maschi', 'Femmine'],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [<?= $_COOKIE["votiMaschili"] ?>, <?= $_COOKIE["votiFemminili"] ?>],
|
||||
data: [<?= $_COOKIE["votiMaschili"] ?>, <?= $_COOKIE[
|
||||
"votiFemminili"
|
||||
] ?>],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"voto_Pellegrini":20,"voto_Egonu":20,"voto_Vio":20,"voto_Totti":16,"voto_Tamberi":17,"voto_Rossi":13}
|
||||
{"voto_Pellegrini":30,"voto_Egonu":30,"voto_Vio":30,"voto_Totti":17,"voto_Tamberi":19,"voto_Rossi":16}
|
Loading…
Add table
Reference in a new issue