-
Notifications
You must be signed in to change notification settings - Fork 1
/
player2.php
235 lines (201 loc) · 10.3 KB
/
player2.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?php include("top.php"); ?>
<?php
if ($users[$_GET["player"]]["nick"] != "") {
$targets = loadTargets();
$cItem = $users[$_GET["player"]];
echo("<b>" . $cItem["nick"] . "</b>");
echo("<br/><br/>");
echo("<table>");
$cnames = countries();
//if($cItem["nick"]=="AndrY") $f=flag2("soviet");
//else
$f=flag($cItem["country"]);
echo("<tr><td width=\"100px\">Nationality:</td><td>" . $f . " " . $cnames[strtoupper($cItem["country"])] . "</td></tr>");
if ($cItem["team"] != "") {
echo("<tr><td>Team:</td><td><a href=\"team.php?team=" . fix($cItem["team"]) . "\">" . fix($cItem["team"]) . "</a></td></tr>");
} else {
echo("<tr><td>Team:</td><td>none</td></tr>");
}
echo("<tr><td>Registered:</td><td>" . gmdate("F jS, Y - H:i:s", ttime($cItem["registered"])) . "</td></tr>");
$utimes = stateTimes($cItem["nick"], $cItem["elmaname"]);
$utt = 0;
for ($y = 0;$y < 54;$y++) $utt += ($utimes[$y+1][1] > 0 ? $utimes[$y+1][1] : 60000);
if ($utimes != NULL) {
$vtimes = array();
$c = 0;
foreach ($users as $cItem) {
$vtimes[] = stateTimes($cItem["nick"], $cItem["elmaname"]);
$c++;
}
$tts = array();
for ($x = 0;$x < $c;$x++) {
$tt = 0;
for ($y = 0;$y < 54;$y++)
$tt += ($vtimes[$x][$y+1][1] > 0 ? $vtimes[$x][$y+1][1] : 60000);
$tts[] = $tt;
}
sort($tts, SORT_NUMERIC);
for ($x = 0;$x < $c;$x++) {
if ($utt == $tts[$x]) {
echo("<tr><td>Ranking:</td><td>#" . ($x+1) . "/" . $c . "</td></tr>");
break;
}
}
}
echo("</table>");
echo("<br/><br/>");
if ($utimes == NULL) {
echo("<span style=\"color: #FF0000\">This kuski man hasn't uploaded stats yet!</span><br/>");
} else {
$cItem = $users[$_GET["player"]];
echo("<b>Times (updated " . gmdate("F jS, Y - H:i:s", ttime(filemtime("statefilesz/" . $cItem["nick"] . ".dat"))) . ")</b> ");
echo("<a href=\"txt.php?u=" . $cItem["nick"] . "\">download stats.txt</a><br/><br/>");
echo("<div class=\"tabber\">");
echo("<div class=\"tabbertab\" title=\"Times\">");
echo("<table class=\"times\" cellpadding=\"2\">");
echo("<tr><th class=\"times\" width=\"180px\">Internal</th>");
echo("<th class=\"times\" width=\"81px\"><center>Best time</center></th>");
echo("<th class=\"times\" width=\"81px\"><center>Average</center></th>");
echo("<th class=\"times\" width=\"81px\"><center>Next target</center></th>");
echo("<th class=\"times\" width=\"81px\"><center>Diff. next</center></th>");
echo("</tr>");
$tt = 0;
$ttIfBeatTargets = 0;
$avgtt = 0;
for ($x = 0;$x < 54;$x++) {
echo("<tr><td class=\"times\">" . internal($x+1, true) . "</td>");
$t = target($utimes[$x+1][1], $x+1);
echo("<td class=\"times\"><center>" . sttime($cItem["nick"], $x+1, $utimes[$x+1][1], true, false, $t) . "</center></td>");
$avg = 0;
for ($y = 0;$y < 10;$y++) {
$avg += ($utimes[$x+1][$y+1] == 0 ? 60000 : $utimes[$x+1][$y+1]);
}
$avgtt += $avg;
$avg = round($avg/10);
echo("<td class=\"times\"><center>" . sttime($cItem["nick"], $x+1, $avg , true, false, target($avg, $x+1)) . "</center></td>");
$tt += ($utimes[$x+1][1] == 0 ? 60000 : $utimes[$x+1][1]);
$ttIfBeatTargets += ($utimes[$x+1][1] == 0 ? 60000 : $utimes[$x+1][1]);
if($t > 0) {
$ttChangeIfBeatTarget = abs($targets[$x+1][$t-1]-$utimes[$x+1][1]);
$ttIfBeatTargets -= $ttChangeIfBeatTarget;
}
echo("<td class=\"times\"><center>" . ($t > 0 ? tartime($x+1, $targets[$x+1][$t-1], $t-1) : "-") . "</center></td>");
echo("<td class=\"times\"><center>" . ($t > 0 ? "+" . formatElmaTime(abs($targets[$x+1][$t-1]-$utimes[$x+1][1])) : "-") . "</center></td>");
echo("</tr>");
}
$avgtt = round($avgtt/10);
echo("<tr><td class=\"times\">Total time</td>");
echo("<td class=\"times\"><center>" . coloredtttime($tt, true) . "</center></td>");
echo("<td class=\"times\"><center>" . coloredtttime($avgtt, true) . "</center></td>");
echo("<td class=\"times\"><center>" . coloredtttime($ttIfBeatTargets, true) . "</center></td>");
echo("</tr>");
echo("</table>");
echo("</div>");
echo("<div class=\"tabbertab\" title=\"Full top10 table\">");
echo("<table class=\"times\" cellpadding=\"2\">");
echo("<tr><th class=\"times\" width=\"24px\">Int</th>");
for ($x = 0;$x < 10;$x++) {
echo("<th class=\"times\" width=\"81px\"><center>" . postr($x+1) . "</center></th>");
}
echo("<th class=\"times\" width=\"81px\"><center>Average</center></th>");
echo("</tr>");
$targetz = array(0, 0, 0, 0, 0, 0, 0, 0);
for ($x = 0;$x < 54;$x++) {
$str = "";
if ($x+1 < 10) $str = " ";
//echo("<tr><td class=\"times\">" . ($x+1) . ". " . $str . $intnames[$x+1] . "</td>");
echo("<tr><td class=\"times\">" . internal($x+1, true, false, false) . "</td>");
$avg = 0;
for ($y = 0;$y < 10;$y++) {
//if ($y == 0) {
//echo("<td class=\"times\"" . $tcolors[target($utimes[$x+1][$y+1], $x)] . "><center>" . sttime($cItem["nick"], $x+1, $utimes[$x+1][$y+1], true) . "</center></td>");
$t = target($utimes[$x+1][$y+1], $x+1);
echo("<td class=\"times\"><center>" . sttime($cItem["nick"], $x+1, $utimes[$x+1][$y+1], true, false, $t) . "</center></td>");
//echo("<td class=\"times\"><center>" . sttime($cItem["nick"], $x+1, $utimes[$x+1][$y+1], true, false) . "</center></td>");
if ($y == 0) $targetz[$t]++;
/*} else {
echo("<td class=\"times\"><center>" . formatElmaTime($utimes[$x+1][$y+1], true) . "</center></td>");
}*/
$avg += ($utimes[$x+1][$y+1] == 0 ? 60000 : $utimes[$x+1][$y+1]);
}
$avg = round($avg/10);
echo("<td class=\"times\"><center>" . sttime($cItem["nick"], $x+1, $avg , true, false, target($avg, $x+1)) . "</center></td>");
//echo("<td class=\"times\"><center>" . formatElmaTime(round($avg/10), true) . "</center></td>");
echo("</tr>");
}
echo("<tr><td class=\"times\">TT</td>");
echo("<td class=\"times\" colspan=\"10\"><center>" . formatElmaTime($tt, true) . "</center></td>");
echo("<td class=\"times\"><center>" . formatElmaTime($avgtt, true) . "</center></td>");
echo("</tr>");
echo("</table>");
echo("</div>");
echo("<div class=\"tabbertab\" title=\"Improvements\">");
echo("Total time improvement (since 14/12/10)<br/><br/>");
$n = 0;
while (file_exists("historyz/" . $_GET["player"] . "_" . $n)) $n++;
if ($n > 1) {
echo("<img alt=\"tt improvementz\" src=\"graph2.php?u=" . $_GET["player"] . "&m=tt&w=780&h=352" . ($users[$_SESSION["nick"]]["theme"] == "Klassik" || $users[$_SESSION["nick"]]["theme"] == "Mopo" ? "&dark=1" : "") . "&fcuk=" . time() . "\"/>");
} else {
echo(error("this user has only uploaded stats once!!") . "<br/>");
}
echo("</div>");
echo("</div>");
echo("<br/><br/><b>Targets</b><br/><br/>");
$ts = "s"; if ($targetz[0] == 1) $ts = "";
echo($targetz[0] . " <span style=\"color: #FF0000\">world record" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[1] == 1) $ts = "";
echo($targetz[1] . " <span style=\"color: #AA43DD\">godlike time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[2] == 1) $ts = "";
echo($targetz[2] . " <span style=\"color: #FF66CC\">legendary time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[3] == 1) $ts = "";
echo($targetz[3] . " <span style=\"color: #FF9C00\">world class time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[4] == 1) $ts = "";
echo($targetz[4] . " <span style=\"color: #FFF200\">professional time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[5] == 1) $ts = "";
echo($targetz[5] . " <span style=\"color: #00FF00\">good time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[6] == 1) $ts = "";
echo($targetz[6] . " <span style=\"color: #0090FF\">OK time" . $ts . "</span><br/>");
$ts = "s"; if ($targetz[7] == 1) $ts = "";
echo($targetz[7] . " beginner time" . $ts . "<br/>");
echo("<br/><br/>");
echo("<b>Compare to...</b><br/><br/>");
echo("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
$i = 0;
foreach ($users as $dItem) {
if ($dItem["nick"] != "" && $dItem["nick"] != $cItem["nick"]) {
if ($i == 0) echo("<tr>");
$t = "";
if ($dItem["team"] != "") $t = " [<a href=\"team.php?team=" . fix($dItem["team"]) . "\">" . fix($dItem["team"]) . "</a>]";
echo("<td>" . flag($dItem["country"]) . " <a href=\"compare.php?u1=" . $cItem["nick"] . "&u2=" . $dItem["nick"] . "\">" . $dItem["nick"] . "</a>" . $t . " </td>");
$i++;
if ($i == 4) {
$i = 0;
echo("</tr>");
}
}
}
if ($i != 0) echo("</tr>");
echo("</table>");
echo("<br/><br/>");
// echo("<b>Userbars and stuff</b><br/><br/>");
// echo("<div class=\"box\">");
// echo("<b>Standard</b><br/>");
// addub("ttst.php?u=" . $_GET["player"] . "&bg=r", $_GET["player"]);
// addub("ttst.php?u=" . $_GET["player"] . "&bg=y", $_GET["player"]);
// addub("ttst.php?u=" . $_GET["player"] . "&bg=g", $_GET["player"]);
// addub("ttst.php?u=" . $_GET["player"], $_GET["player"]);
// addub("ttst.php?u=" . $_GET["player"] . "&bg=p", $_GET["player"]);
// addub("ttst.php?u=" . $_GET["player"] . "&bg=k", $_GET["player"]);
// echo("<br/><b>Simpel and customizabel</b><br/>");
// addub("tt.php?u=" . $_GET["player"], $_GET["player"]);
// addub("tt.php?u=" . $_GET["player"] . "&s=TT:%20%5B:tt:%5D&bg=000000&c=FF0000", $_GET["player"]);
// echo("<br/><b>Belma</b><br/>");
// addub("bub.php?u=" . $_GET["player"], $_GET["player"]);
// addub("bub.php?u=" . $_GET["player"] . "&s=<" . $_GET["player"] . ">%20hi%20my%20TT%20is%20:tt:%20:D)", $_GET["player"]);
// echo("</div>");
}
} else {
echo("<span style=\"color: #FF0000\">Player \"" . $_GET["player"] . "\" doesn't exist!</span><br/>");
}
?>
<?php include("tpo.php"); ?>