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
rpsgame-ajax.php
105 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
<?php require("../incl/dbconnection.php");
if(isset($_GET['matchkey']) AND isset($_GET['currentround'])){
if (!isset($_GET['currentround'])) {
echo "Error: round not set.";
}
checkMoveStatusV1V2($dbconn,
htmlspecialchars($_GET['matchkey'], ENT_QUOTES, 'UTF-8'),
$_GET['currentround']);
}
function checkMoveStatusV1V2($dbconn,$matchkey,$currentround){
$sql = "SELECT
m.matchid,
m.player1id,
m.player2id,
u1.userid AS p1id,
u2.userid AS p2id,
u1.rps AS u1move,
u2.rps AS u2move
FROM matches AS m
INNER JOIN moves AS u1 ON m.player1id = u1.userid
INNER JOIN moves AS u2 ON m.player2id = u2.userid
WHERE matchid = ?";
$stmt = $dbconn->prepare($sql);
$data=[$matchkey];
$stmt->execute($data);
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
//echo $res[];
}
$sql = "SELECT COUNT(*) AS total FROM moves WHERE matchkey = ? AND round = ?";
$stmt = $dbconn->prepare($sql);
$stmt->execute([$matchkey, $currentround]);
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
if($res['total']==2){
$sql="SELECT * FROM moves WHERE matchkey=? AND round=? /*AND NOT userid=?*/";
$stmt = $dbconn->prepare($sql);
$data=[$matchkey,$currentround/*,$_SESSION['userid']*/];
$stmt->execute($data);
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
if($res['userid']!=$_SESSION['userid']){
echo "opponent: ".$res['rps'].'<br>';
}
else if($res['userid']==$_SESSION['userid']){
echo "your move: ".$res['rps']."<br>";
}
}
}
else if($res['total']==1){
echo "waiting for opponent or you";
}
else if($res['total']==0){
echo "waiting for your move<br>";
}
$sql="SELECT roundAmount FROM matches WHERE matchid = ?";
$stmt = $dbconn->prepare($sql);
$stmt->execute([$matchkey]);
while($res = $stmt->fetch(PDO::FETCH_ASSOC)){
if($res['roundAmount']==$currentround){
header("Location:rpsgameresults.php?matchkey=$matchkey");
$_SESSION['isInGame'] = false;
exit;
}
}
echo "<hr><strong>hela matchen:</strong><br>";
$currentmaxround = 1;
$sql = "SELECT round FROM moves WHERE matchkey = ? ORDER BY round DESC LIMIT 1";
$stmt = $dbconn->prepare($sql);
$stmt->execute([$matchkey]);
if($res=$stmt->fetch(PDO::FETCH_ASSOC)){
$currentmaxround=$res['round'];
}
//get matchinfo
$sql = "SELECT round, userid, rps FROM moves WHERE matchkey = ? ORDER BY round ASC, userid ASC";
$stmt = $dbconn->prepare($sql);
$stmt->execute([$matchkey]);
$hasmademove=false;
$currentround = -1;
while ($move = $stmt->fetch(PDO::FETCH_ASSOC)){
// New round header
if ($currentround != $move['round']) {
$currentround = $move['round'];
echo "<br>Round $currentround:<br>";
}
(int)$currentround;
$matchoutput="";
// Identify if it's the current user or opponent
if ($move['userid'] == $_GET['userid']) {
$matchoutput .= "Du: ".$move['rps']."<br>";
}
else if ($currentround>=1 AND $currentround!=$currentmaxround){
$matchoutput .= "Motståndare: ".$move['rps']."<br>";
}
//echo "$matchoutput: ".$move['rps']."<br>";
echo $matchoutput;
}
}
}
?>