-
Notifications
You must be signed in to change notification settings - Fork 1
/
esfunc.php
113 lines (100 loc) · 3.09 KB
/
esfunc.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
<?php
//Functions
include("func.php");
//Load users
$users = array(array());
$files = array();
$handle = opendir("usersz/");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") $users[$file] = loadUser($file);
}
closedir($handle);
//Load intnames
$intnames = array();
$lines = file("intnames.txt");
$i = 0;
foreach ($lines as $line_num => $line) {
$i++;
$line = str_replace("\r\n", "\n", $line);
$intnames[$i] = substr($line, 0, strlen($line)-1);
}
$c = 0;
$players = array();
$utimes = array();
while ($_GET["player" + ($c+1)] != "") {
$player = $_GET["player" + ($c+1)];
if ($users[$player]["nick"] == "") {
foreach ($users as $user) {
if (strtolower($player) == strtolower($user["nick"])) $player = $user["nick"];
}
}
if ($users[$player]["nick"] != "") {
$players[] = $player;
$utimes[] = stateTimes($player, $users[$player]["elmaname"]);
} else {
break;
}
}
//TEMP
$player = $_GET["player"];
if ($users[$player]["nick"] == "") {
foreach ($users as $user) {
if (strtolower($player) == strtolower($user["nick"])) $player = $user["nick"];
}
}
$utimes = stateTimes($player, $users[$player]["elmaname"]);
//-TEMP
/*switch ($_GET["mode"]) {
case "time":
if ($utimes[0] == NULL) {
echo("this kuski man hasnt upped stats :0");
} else {
if ((int)$_GET["int"] > 0 && (int)$_GET["int"] < 55) {
if ($utimes[(int)$_GET["int"]][1] == 0) {
echo($player . " hasnt finished this int :D)");
} else {
echo($player . "s time in " . $intnames[(int)$_GET["int"]] .
" is " . formatElmaTime($utimes[(int)$_GET["int"]][1]));
}
} else {
echo("xd");
}
}
break;*/
if ($users[$player]["nick"] != "") {
$cItem = $users[$player];
$utimes = stateTimes($cItem["nick"], $users[$player]["elmaname"]);
if ($utimes == NULL) {
echo("this kuski man hasnt upped stats :0");
} else {
if ($_GET["mode"] == "time") {
if ((int)$_GET["int"] > 0 && (int)$_GET["int"] < 55) {
//Load intnames
$intnames = array();
$lines = file("intnames.txt");
$i = 0;
foreach ($lines as $line_num => $line) {
$i++;
$line = str_replace("\r\n", "\n", $line);
$intnames[$i] = substr($line, 0, strlen($line)-1);
}
if ($utimes[(int)$_GET["int"]][1] == 0) {
echo($player . " hasnt finished this int :D)");
} else {
echo($player . "s time in " . $intnames[(int)$_GET["int"]] .
" is " . formatElmaTime($utimes[(int)$_GET["int"]][1]));
}
} else {
echo("xd");
}
}
if ($_GET["mode"] == "tt") {
$tt = 0;
for ($x = 0;$x < 54;$x++) $tt += ($utimes[$x+1][1] == 0 ? 60000 : $utimes[$x+1][1]);
echo($player . "s TT is " . formatElmaTime($tt));
}
}
} else {
echo($player . " doesnt exist!");
}
?>