-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
results.php
53 lines (47 loc) · 1.15 KB
/
results.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
include "connection.php";
if (isset($_SESSION['id'])) {
?>
<?php if(!isset($_SESSION['score'])) {
header("location: question.php?n=1");
}
?>
<html>
<head>
<title>PHP-kuiz</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<header>
<div class="container">
<h1>PHP-Kuiz</h1>
</div>
</header>
<main>
<div class= "container">
<h2>Congratulations!</h2>
<p>You have successfully completed the test</p>
<p>Total points: <?php if (isset($_SESSION['score'])) {
echo $_SESSION['score'];
}; ?> </p>
<a href="question.php?n=1" class="start">Start Again</a>
<a href="home.php" class="start">Go Home</a>
</div>
</main>
</body>
</html>
<?php
$score = $_SESSION['score'];
$email = $_SESSION['email'];
$query = "UPDATE users SET score = '$score' WHERE email = '$email'";
$run = mysqli_query($conn , $query) or die(mysqli_error($conn));
?>
<?php unset($_SESSION['score']); ?>
<?php unset($_SESSION['time_up']); ?>
<?php unset($_SESSION['start_time']); ?>
<?php }
else {
header("location: home.php");
}
?>