-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrivia.php
188 lines (158 loc) · 5.56 KB
/
trivia.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
require_once 'assets/config/config.php';
require_once "vendor/autoload.php";
use PhotoTech\ErrorHandler;
use PhotoTech\Database;
use PhotoTech\Trivia;
$errorHandler = new ErrorHandler();
// Register the exception handler method
set_exception_handler([$errorHandler, 'handleException']);
$database = new Database();
$pdo = $database->createPDO();
$trivia = new Trivia($pdo);
$username = 'guest';
/*
* Cool Trivia Game
* created by John Pepp
* on February 17, 2023
* modified on June 24, 2023
*/
try {
$today = new DateTime("Now", new DateTimeZone("America/Detroit"));
} catch (Exception $e) {
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=yes, initial-scale=1.0">
<title>Coolest Trivia Around</title>
<link rel="stylesheet" media="all" href="assets/css/trivia.css">
<style>
#headerStyle {
display: flex;
justify-content: space-between;
background-color: #fff;
padding: 0.625em;
}
#timerStyle {
color: #4CAF50;
}
#score {
color: #4CAF50;
}
#percent {
color: #4CAF50;
}
.quit-button {
float: right;
color: white;
background-color: red;
border: none;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 0.625em 0.125em;
cursor: pointer;
transition: all 0.3s ease; /* Add transition effect */
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3); /* Add box-shadow for 3D feel */
border-radius: 5px; /* Add border-radius for rounded corners */
}
/* Add hover effect */
.quit-button:hover {
background-color: darkred; /* Change background color on hover */
box-shadow: 3px 3px 15px rgba(0, 0, 0, 0.5); /* Increase box-shadow on hover for more depth */
transform: scale(1.05); /* Slightly increase the size on hover */
}
/* Add active (clicked) effect */
.quit-button:active {
transform: scale(0.95); /* Slightly decrease the size when button is clicked */
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3); /* Reduce box-shadow when button is clicked */
}
</style>
</head>
<body class="site">
<header class="nav">
<input type="checkbox" class="nav-btn" id="nav-btn">
<label for="nav-btn">
<span></span>
<span></span>
<span></span>
</label>
<nav class="nav-links" id="nav-links">
<?php $database->regular_navigation(); ?>
</nav>
<div class="name-website">
<h1 class="webtitle">The Photo Tech Guru</h1>
</div>
</header>
<main id="content" class="main">
<div id="openingScreen">
<img src="assets/images/img-opening-001.jpg" alt="trivia opening graphic">
</div>
<div id="quiz" class="displayMessage" data-username="<?= $username ?>">
<div class="triviaContainer" data-records=" ">
<div id="mainGame">
<div id="current">Current question is <span id="currentQuestion" data-record=""></span></div>
<div id="triviaSection" data-correct="">
<div id="questionBox">
<h2 id="question"></h2>
<button class="buttonStyle" id="ans1"></button>
<button class="buttonStyle" id="ans2"></button>
<button class="buttonStyle" id="ans3"></button>
<button class="buttonStyle" id="ans4"></button>
</div>
<div id="buttonContainer"></div>
</div>
</div>
<button id="next" class="nextBtn">Next</button>
</div>
</div>
</main>
<aside class="sidebar">
<h1 class="catHeading">Categories</h1>
<nav id="legoNav" class="vertical-nav">
<ul class="disableButtons">
<li><a class="category" id="lego" href="#">LEGO</a></li>
<li><a class="category" id="photography" href="#">Photography</a></li>
<li><a class="category" id="space" href="#">Space</a></li>
<li><a class="category" id="movie" href="#">Movie</a></li>
<li><a class="category" id="sport" href="#">Sports</a></li>
</ul>
</nav>
<div id="headerStyle" data-user="">
<p id="timerStyle">Time Left : <span id="clock"></span></p>
<p id="score">Points: 0</p>
<p id="percent">100% Correct</p>
</div>
<div class="addTriviaInfo">
<table id="scoreboard" class="styled-table">
<thead>
<tr class="tableTitle">
<th colspan="2">High Scores - <?= $today->format("F j, Y") ?></th>
</tr>
<tr class="subTitle">
<th>Name</th>
<th>Points</th>
</tr>
</thead>
<tbody class="anchor">
</tbody>
</table>
<button id="quitButton" class="quit-button">Quit</button>
</div>
<div id="finalResult">
<h2>Game Over!</h2>
<p><?= $username ?> ended up with <span class="totalScore"></span> points and answered <span
class="answeredRight"></span> right.</p>
<a class="btn1" href="game.php" title="Quiz">Play Again?</a>
</div>
</aside>
<script src="assets/js/trivia.js"></script>
<!--<script src="assets/js/fetchTriviaApi.js"></script>-->
</body>
</html>