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
results.php
124 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php require('logincheck.php'); $userKey = $_SESSION['userid'];?>
<html>
<body>
<h1>Quizresultat</h1>
<h3>välkommen <?php echo $_SESSION['user']; ?></h3>
välj quiz
<br>
<?php
$sql = "SELECT * FROM qlist";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
$quizName = $res['qlname'];
echo('<form action="" method="GET"><button type="submit" name="quiz" value="'.$quizName.'">'.$quizName.'</button>');
}
?>
</form>
<?php
if(isset($_GET['quiz'])){
$selectedQuiz = $_GET['quiz'];
$sql = "SELECT * FROM qlist WHERE qlname='$selectedQuiz'";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
$quizID = $res['listid'];
}
echo $selectedQuiz.'<br><br>';
$sql = "SELECT * FROM quserresults WHERE quizkey='$quizID' AND userkey='$userKey'";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
echo '<br>ditt resultat: '.$res['totscore'];
echo '<br>'.$res['htmldata'];
}
if($_SESSION['isadmin']==1){
echo "<br>-----<br>admin access<br>-----<br>
<br>allas resultat<br>";
$ukeys = [];
$uscores =[];
$uscoreindex = 0;
$sql = "SELECT quserresults.userkey, quserresults.totscore, qusers.username FROM quserresults CROSS JOIN qusers ON quserresults.userkey=qusers.userid WHERE quserresults.quizkey = '$quizID' ORDER BY quserresults.totscore DESC, qusers.username ASC";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
$uscore = $res['totscore'];
$ukey = $res['userkey'];
array_push($ukeys, $ukey);
array_push($uscores, $uscore);
$un = $res['username'];
echo $un.' '.$uscore.'<br>';
}
}
$scoreArray =[];
$sql = "SELECT * FROM quserresults WHERE quizkey='$quizID'";
$stmt = $dbconn->prepare($sql);
$stmt->execute();
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
array_push($scoreArray, $res['totscore']);
}
sort($scoreArray);
$scorecount = count($scoreArray);
$maxscore = $scoreArray[$scorecount-1];
$xValues = [];
$yValues = [];
$x=0;
while($x<=$maxscore){
$tempAns = 0;
array_push($xValues, $x);
foreach($scoreArray as $y){
if($y == $x){
$tempAns +=1;
}
}
$x+=1;
array_push($yValues, $tempAns);
}
}
?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<canvas id="myChart" style="width:100%;max-width:600px"></canvas>
<script>
let xValues = <?php echo(json_encode($xValues)); ?>;
let yValues = <?php echo(json_encode($yValues)); ?>;
const barColors = ["red"];
new Chart("myChart", {
type: "bar",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
legend: {display: false},
title: {
display: true,
text: "Resultat"
}
}
});
</script>
</body>
</html>