-
Notifications
You must be signed in to change notification settings - Fork 2
/
login.php
49 lines (44 loc) · 1.06 KB
/
login.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
<?php
session_start();
error_reporting(0);
?>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="jeopardy.css">
</head>
<body>
<?php
$scoreboard=file_get_contents("scores.txt");
$scoreboardList=explode(PHP_EOL, $scoreboard);
$scoreboardArr = [];
foreach ($scoreboardList as $scorb) {
$scoreboardLines = explode(",", $scorb);
array_push($scoreboardArr, $scoreboardLines);
}
$foundScores=array();
foreach ($scoreboardArr as $x) {
if (strtolower($x[0]) == strtolower($_POST['userName'])){
array_push($foundScores, $x[1]);
}
} ?>
<div class="qCard"> <?php
if (count($foundScores)>0){
?>
<h1>Found scores for <?php echo $_POST['userName'] ?>:</h1>
<?php
foreach ($foundScores as $y) {
echo $y.PHP_EOL;
}
}
else { ?>
<h1>This user has no recorded scores.</h1> <?php
}
?>
<form action="signup.php" method="post">
<input type="submit" value="Play again!">
</form>
</div>
</body>
</html>