Show sourcecode
The following files exists in this folder. Click to view.
bacon-egg-pizza.php
cquiz.php
create-account.php
create-account111.php
create-quiz.php
create-quiz2.php
createaccount.php
delete-quiz.php
drop-rps-tables.php
legacy-code-rps.php
legacy-index.php
login.php
logincheck.php
newpassword-verify.php
newpassword.php
potential-code.txt
quiz-db-init.php
quizhub.php
quizhub2.php
results.php
rpsaccount-ajax-user-search.php
rpsaccount.php
rpsbetting-ajax-match-finder.php
rpsbetting.php
rpsbettingleaderboard.php
rpschangepassword.php
rpschangepassword.txt
rpsgame-ajax.php
rpsgame.php
rpsgameresults.php
rpshostnewgame.php
rpshub.php
rpsleaderboard.php
rpslib.php
rpslogin.php
rpsmaininclude.php
rpsproject/
rpsusersearch.php
table-init.php
verification.php
create-quiz2.php
106 lines UTF-8 Windows (CRLF)
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
<?php require('logincheck.php');
if($_SESSION['isadmin']!=1){
header("Location:quizhub.php");
die;
}
echo'
<html>
<h1>Skapa ett quiz!</h1>
skriv namn och skicka för nytt quiz, sedan namn på fråga och antal svar och därefter svaren och om korrekt och sedan skicka och ett nytt namn på en fråga eller nytt quiz. reset session för att rensa (mest för debugging).
<form action="" method="POST">
<table>
<tr>
<td>
namn
</td>
<td>
<input type="text" name="quizname">
</td>
</tr>
<tr><td><input type="submit">
</table>
</form>
';
if(isset($_POST['quizname'])){
$_SESSION['x']=0;
$currentquiz = htmlentities($_POST['quizname']);
$sql = "INSERT INTO qlist (qlname) VALUES (?)";
$stmt = $dbconn -> prepare($sql);
$data = [$currentquiz];
$stmt -> execute($data);
$sql = "SELECT * FROM qlist WHERE qlname='$currentquiz'";
$stmt = $dbconn -> prepare($sql);
$stmt -> execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
$_SESSION['cqkey'] = $res['listid'];
echo 'quiznyckel'.$_SESSION['cqkey'];
}
}
if(isset($_SESSION['cqkey'])){
echo '
<form action="" method="POST">
frågans namn: <input type="text" name="questionName">
antal svar: <input type="number" min="1" name="qamount">
<input type="submit">
</form>';
if(isset($_POST['questionName'])){
$qname = htmlspecialchars($_POST['questionName']);
$sql = "INSERT INTO qquestions (qlkey, qqname) VALUES (?,?)";
$stmt = $dbconn -> prepare($sql);
$data = [$_SESSION['cqkey'], $qname];
$stmt -> execute($data);
echo $qname;
$sql = "SELECT * FROM qquestions WHERE qqname='$qname'";
$stmt = $dbconn -> prepare($sql);
$stmt -> execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
$_SESSION['cqqkey'] = $res['questionid'];
echo 'frågenyckel'.$_SESSION['cqqkey'];
}
echo '<br>antal frågor: '.$_POST['qamount'];
$_SESSION['x'] = 1;
echo '<form action="" method="POST">';
$x=1;
while ($x <= $_POST['qamount']){
echo '<br>
svar'.$x.': <input type="text" name="'.$x.'">
1=rätt, 0=fel: <input type="number" min="0" max="1" name="iscorrect'.$x.'">';
$x+=1;
}
echo '<input type="submit"></form>';
$_SESSION['qamount'] = $_POST['qamount'];
}
if(isset($_POST['1'])){
echo $_SESSION['x'];
if($_SESSION['x']>0){
$maxq = $_SESSION['qamount'];
$x=1;
while($x<=$maxq){
$sql = "INSERT INTO questionanswers (qqkey, ans, correct) VALUES (?,?,?)";
$stmt = $dbconn -> prepare($sql);
$data = [$_SESSION['cqqkey'],htmlentities($_POST[$x]), htmlentities($_POST['iscorrect'.$x])];
$stmt -> execute($data);
$x+=1;
}
echo 'question inserted';
}
}
}
?>
</html>