-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_marksheet.php
301 lines (211 loc) · 15.9 KB
/
submit_marksheet.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "connection_pdo.php";
if (!isset($_SESSION['username'])) {
header("location:login.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marksheet</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- navbar section -->
<header class="navbar-section">
<nav class="navbar navbar-expand-lg">
<div class="container-fluid">
<a class="navbar-brand" href="#"></i> Debating Tool</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="home.php">home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="marksheet.php">restart</a>
</li>
<li class="nav-item">
<div class="dropdown">
<a class='nav-link dropdown-toggle' href='edit.php?id=$res_id' id='dropdownMenuLink'
data-bs-toggle='dropdown' aria-expanded='false'>
<i class='bi bi-person'></i>
</a>
<ul class="dropdown-menu mt-2 mr-0" aria-labelledby="dropdownMenuLink">
<li>
<?php
$id = $_SESSION['id'];
$query = $connection_pdo->prepare("SELECT * FROM users WHERE id = :id");
$query->execute(['id' => $id]);
$result = $query->fetch(PDO::FETCH_ASSOC);
$res_username = $result['username'];
//$res_email = $result['email'];
$res_id = $result['id'];
echo "<a class='dropdown-item' href='edit.php?id=$res_id'>Change Profile</a>";
?>
</li>
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- marksheet section -->
<?php
require_once "dbh.inc.php";
$check = $_POST['debate_round'].$_POST['start_debate_pro_TeamID'].$_POST['start_debate_con_TeamID'];
?>
<section class= "marksheet-section">
<div class="container">
<div class="row gy-4">
<div class="col-sm-3">
</div>
<div class="col-lg-6">
<h1>Marksheet</h1>
<div>
<h2 style="color: #FF0000">Note the following number (including the slashes) on the paper marksheet if the following results are correct. </h2>
<h2 style="color: #FF0000">Do this before confirming!!!</h2>
<h3>Number: #<?php if(isset($_POST['debate_round'])) echo $_POST['debate_round']."/" ?><?php if(isset($_POST['start_debate_pro_TeamID'])) echo $_POST['start_debate_pro_TeamID']."/" ?> <?php if(isset($_POST['start_debate_con_TeamID'])) echo $_POST['start_debate_con_TeamID'] ?></h3>
<br>
</div>
<h2>Confirm the debate results!</h2>
<form action="submit_marksheet.php" method="post" class="php-email-form">
<!--
<p class="col-sm-6">Runde: <?php //if(isset($_POST['debate_round'])) echo $_POST['debate_round']; ?></h3>
<h3 class="col-sm-6">Raum: <?php //if(isset($_POST['selected_debate_room'])) echo $_POST['selected_debate_room']?></h3>
<h3 class="col-sm-6">Team Pro: <?php //if(isset($_POST['start_debate_pro_TeamID'])) echo $_POST['start_debate_pro_TeamID'] ?></h3>
<h3 class="col-sm-6">Team Con: <?php //if(isset($_POST['start_debate_con_TeamID'])) echo $_POST['start_debate_con_TeamID'] ?></h3>
-->
<div>
<p>
<?php
ob_start(); // Starte den Output-Buffer weil beim reloaden endDebate Funktion herrumbitcht
//Diese datei wird in zukunft durchs frontend nicht mehr index sein,also lies die komentare
//Beim ändern wichtig: die header Location beim abschickbutton auch ändern zurück an diese datei
// Datenbankmanager einbinden/ Databasemanager einbinden
//Startet main funktion auch wenn es nicht wichtig ist da mein Gehirn in java gefangen ist
// Einstiegspunkt für das Skript/ Hauptfunktion
//Datenbank verbindung herstellen
//Wenn rehcnen sumbit button gedrückt wird, wird die setterVraiblen Funktion für setten der werte und rechnen ausgeführt
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['Rechnen']) && $_POST['Rechnen'] == 'Submit') {
setterVariables();
ehcofunc($connection_pdo);//Debugausgabe
}
/*
//Wenn auswertung gedrückt wird werden die sieger und daten gezeigt
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['Admin']) && $_POST['Admin'] == 'Submit'){
header("Location: adminpage.php");
//auswertung($pdoindex);
exit;
} */
ob_end_flush(); // Sende den gepufferten Output
?>
</p>
<input type="hidden" name="debate_room" id="debate_room" value="<?php if(isset($_POST['selected_debate_room'])) echo $_POST['selected_debate_room'] ?>" >
<input type="hidden" name="debate_round" id="debate_round" value="<?php if(isset($_POST['debate_round'])) echo $_POST['debate_round'] ?>" >
<input type="hidden" name="start_debate_pro_TeamID" id="start_debate_pro_TeamID" value="<?php if(isset($_POST['start_debate_pro_TeamID'])) echo $_POST['start_debate_pro_TeamID'] ?>">
<input type="hidden" name="start_debate_con_TeamID" id="start_debate_con_TeamID" value="<?php if(isset($_POST['start_debate_con_TeamID'])) echo $_POST['start_debate_con_TeamID'] ?>" >
<input type="hidden" name="debate_pro_Player_1" id="debate_pro_Player_1" value="<?php if(isset($_POST['debate_pro_Player_1'])) echo $_POST['debate_pro_Player_1'] ?>">
<input type="hidden" name="debate_pro_Player_2" id="debate_pro_Player_2" value="<?php if(isset($_POST['debate_pro_Player_2'])) echo $_POST['debate_pro_Player_2'] ?>">
<input type="hidden" name="debate_pro_Player_3" id="debate_pro_Player_3" value="<?php if(isset($_POST['debate_pro_Player_3'])) echo $_POST['debate_pro_Player_3'] ?>">
<input type="hidden" name="debate_pro_Player_reply" id="debate_pro_Player_reply" value="<?php if(isset($_POST['debate_pro_Player_reply'])) echo $_POST['debate_pro_Player_reply'] ?>">
<input type="hidden" name="debate_points_pro_Player_1" id="debate_points_pro_Player_1" value="<?php if(isset($_POST['debate_points_pro_Player_1'])) echo $_POST['debate_points_pro_Player_1'] ?>">
<input type="hidden" name="debate_points_pro_Player_2" id="debate_points_pro_Player_2" value="<?php if(isset($_POST['debate_points_pro_Player_2'])) echo $_POST['debate_points_pro_Player_2'] ?>">
<input type="hidden" name="debate_points_pro_Player_3" id="debate_points_pro_Player_3" value="<?php if(isset($_POST['debate_points_pro_Player_3'])) echo $_POST['debate_points_pro_Player_3'] ?>">
<input type="hidden" name="debate_points_pro_Player_reply" id="debate_points_pro_Player_reply" value="<?php if(isset($_POST['debate_points_pro_Player_reply'])) echo $_POST['debate_points_pro_Player_reply'] ?>">
<input type="hidden" name="debate_con_Player_1" id="debate_con_Player_1" value="<?php if(isset($_POST['debate_con_Player_1'])) echo $_POST['debate_con_Player_1'] ?>">
<input type="hidden" name="debate_con_Player_2" id="debate_con_Player_2" value="<?php if(isset($_POST['debate_con_Player_2'])) echo $_POST['debate_con_Player_2'] ?>">
<input type="hidden" name="debate_con_Player_3" id="debate_con_Player_3" value="<?php if(isset($_POST['debate_con_Player_3'])) echo $_POST['debate_con_Player_3'] ?>">
<input type="hidden" name="debate_con_Player_reply" id="debate_con_Player_reply" value="<?php if(isset($_POST['debate_con_Player_reply'])) echo $_POST['debate_con_Player_reply'] ?>">
<input type="hidden" name="debate_points_con_Player_1" id="debate_points_con_Player_1" value="<?php if(isset($_POST['debate_points_con_Player_1'])) echo $_POST['debate_points_con_Player_1'] ?>">
<input type="hidden" name="debate_points_con_Player_2" id="debate_points_con_Player_2" value="<?php if(isset($_POST['debate_points_con_Player_2'])) echo $_POST['debate_points_con_Player_2'] ?>">
<input type="hidden" name="debate_points_con_Player_3" id="debate_points_con_Player_3" value="<?php if(isset($_POST['debate_points_con_Player_3'])) echo $_POST['debate_points_con_Player_3'] ?>">
<input type="hidden" name="debate_points_con_Player_reply" id="debate_points_con_Player_reply" value="<?php if(isset($_POST['debate_points_con_Player_reply'])) echo $_POST['debate_points_con_Player_reply'] ?>">
<input type="hidden" name="debate_submitterID" id="debate_submitterID" value="<?php if(isset($_SESSION['id'])) echo $_SESSION['id']?>">
<input type="hidden" name="debate_bestplayer_ID" id="debate_bestplayer_ID" value="<?php if(isset($_POST['debate_bestplayer_ID'])) echo $_POST['debate_bestplayer_ID'] ?>">
<input type="hidden" name="debate_winner_TeamID" id="debate_winner_TeamID" value="<?php if(isset($_POST['debate_winner_TeamID'])) echo $_POST['debate_winner_TeamID'] ?>">
<center>
<div>
<h2 style="color: #FF0000">Check if these are the correct results!!!! Else go back to the marksheet tab and restart.</h2>
<button type="submit" name="Abschicken" value="Submit" style="background:linear-gradient(45deg, red, blue);"> CONFIRM </button>
</div>
</center>
</div>
</form>
<p>
<?php
ob_start(); // Starte den Output-Buffer weil beim reloaden endDebate Funktion herrumbitcht
//Diese datei wird in zukunft durchs frontend nicht mehr index sein,also lies die komentare
//Beim ändern wichtig: die header Location beim abschickbutton auch ändern zurück an diese datei
// Datenbankmanager einbinden/ Databasemanager einbinden
//Startet main funktion auch wenn es nicht wichtig ist da mein Gehirn in java gefangen ist
//wenn Abschickenbutton gedrückt werden alle wichtigen daten zur datenbank gesendet
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['Abschicken']) && $_POST['Abschicken'] == 'Submit') {
$smt = $connection_pdo->prepare('SELECT * FROM debates WHERE debate_con_TeamID = :conteamID AND debate_pro_TeamID = :proteamID AND debate_round = :debateRound');
$smt->execute(['conteamID' => $_POST['start_debate_con_TeamID'],'proteamID' => $_POST['start_debate_pro_TeamID'], 'debateRound' => $_POST['debate_round']]);
$resultscheck = $smt->fetchAll();
if(empty($resultscheck)){
setterVariables();
endDebate($connection_pdo);
//auswertung($pdoindex);, kann für live aktualisierung beim jedem abschicken sorgen
// Redirect zurück hier (jetzt grad index.php also beim umbennen dieser datei ändern)
//(um beim reload zuverhindern das die post argumente im url noch mal ausgeführt werden)
exit; // Stelle sicher, dass nach dem Redirect kein weiterer Code ausgeführt wird
}
}
ob_end_flush(); // Sende den gepufferten Output
?>
</p>
</div>
</div>
</div>
</section>
<!-- footer section -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-4 col-md-12 col-sm-12">
<p class="logo"></i> Debating Tool</p>
</div>
<div class="col-lg-5 col-md-12 col-sm-12">
<ul class="d-flex">
<li><a href="home.php">Home</a></li>
<li><a href="marksheet.php">Restart</a></li>
</ul>
</div>
<div class="col-lg-2 col-md-12 col-sm-12">
<p>©
<a href="https://github.com/Cybersky4" target="_blank" style="color: inherit; text-decoration: underline;">2024_Cyber</a>,
<a href="https://github.com/silverhadch" target="_blank" style="color: inherit; text-decoration: underline;">Hadi</a>
</p>
</div>
<div class="col-lg-1 col-md-12 col-sm-12">
<!-- back to top -->
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i
class="bi bi-arrow-up-short"></i></a>
</div>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
crossorigin="anonymous"></script>
</body>
</html>