54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
include "includes/functions.php";
|
|
|
|
checkSession();
|
|
|
|
$mediaPrecedente = risultatiPrecedenti();
|
|
|
|
$domande = [];
|
|
$punteggio = 0;
|
|
|
|
if ($_SESSION["sceltaHobby"] == "m") {
|
|
$domande = json_decode(file_get_contents("includes/musica.json"));
|
|
} else if ($_SESSION["sceltaHobby"] == "s") {
|
|
$domande = json_decode(file_get_contents("includes/sport.json"));
|
|
}
|
|
|
|
foreach ($domande as $numeroDomanda => $domanda) {
|
|
if ($_POST["risposta_domanda_" . $numeroDomanda] == $domanda[1]) {
|
|
$punteggio += 1;
|
|
} else {
|
|
$punteggio -= 1;
|
|
}
|
|
}
|
|
|
|
addVote($punteggio, $_SESSION["sceltaHobby"]);
|
|
|
|
session_destroy();
|
|
?>
|
|
|
|
<!DOCTYPE HTML>
|
|
<html lang="it">
|
|
|
|
<head>
|
|
<title>Login</title>
|
|
<?php require "includes/head.php" ?>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
<h1>Grazie per aver votato</h1>
|
|
<h2>Il tuo punteggio é <?= $punteggio ?></h2>
|
|
<h2>Media per la categoria Musica: <?= round($mediaPrecedente["mediaMusica"], 2) ?></h2>
|
|
<h3>Numero voti Musica: <?= $mediaPrecedente["nVotiMusica"] ?></h3>
|
|
<h2>Media per la categoria Sport: <?= round($mediaPrecedente["mediaSport"], 2) ?></h2>
|
|
<h3>Numero voti Sport: <?= $mediaPrecedente["nVotiSport"] ?></h3>
|
|
<a href="/moro_detto_rocco_verifica_php/login.php">Ritorna al Login</a>
|
|
</div>
|
|
|
|
<?php require "includes/footer.php" ?>
|
|
|
|
</body>
|
|
</html>
|
|
|