Verifica PHP
This commit is contained in:
parent
ba05612a57
commit
e7e4759083
52 changed files with 59839 additions and 0 deletions
54
moro_detto_rocco_verifica_php/risultati.php
Normal file
54
moro_detto_rocco_verifica_php/risultati.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?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>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue