-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults.php
74 lines (61 loc) · 2.71 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
session_start();
include "config.php";
if (isset($_SESSION['id'])) {
?>
<?php if (!isset($_SESSION['score'])) {
header("location: question.php?n=1");
}
?>
<html>
<head>
<title>PHP Quizzer</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="./assets/main.css">
<!-- fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
</head>
<body>
<header>
<nav class="navbar navbar-light bg-light shadow rounded">
<a class="navbar-brand" href="index.php">PHP Quizzer</a>
<a class="nav-link" href="admin.php">Admin Login</a>
</nav>
</header>
<main>
<div class="container h-100 d-flex justify-content-center">
<div class="my-auto shadow rounded p-5">
<h2>Quiz Ended</h2>
<p>You have successfully completed the quiz</p>
<p>Total Questions:
<?php
$total = "SELECT * FROM questions ";
$run = mysqli_query($conn, $total) or die(mysqli_error($conn));
$totalqn = mysqli_num_rows($run);
echo $totalqn;
?>
</p>
<p>Correct answer count: <?php
echo $_SESSION['score'];
?>
</p>
<p>
Incorrect answer count: <?php echo ($totalqn - $_SESSION['score']);
?>
</p>
<a href="home.php" class="btn btn-secondary">Go Home</a>
</div>
</div>
</main>
</body>
</html>
<?php } else {
header("location: home.php");
}
?>