-
Notifications
You must be signed in to change notification settings - Fork 1
/
ttst.php
61 lines (58 loc) · 1.87 KB
/
ttst.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
<?php
//crap script used to make TT images
//parameters:
// u user
// bg bg color (b: blue, g: green...)
include("func.php");
addUbCounter();
$utimes = stateTimes($_GET["u"]);
if ($utimes != NULL) {
//kalkulate tt
$tt = 0;
for ($x = 0;$x < 54;$x++) {
$cTime = $utimes[$x+1][1];
if ($cTime == 0) $cTime = 60000;
$tt += $cTime;
}
$str = formatElmaTime($tt);
} else {
$str = "N/A";
}
//Load users
$users = array(array());
$files = array();
$handle = opendir("usersz/");
while (false !== ($file = readdir($handle))) {
$files[] = "usersz/" . $file;
}
closedir($handle);
foreach ($files as $file) {
$lines = file($file);
$i = 0;
foreach ($lines as $line_num => $line) {
$i++;
switch ($i) {
case 1: $nick = substr($line, 0, strlen($line)-1); $users[$nick]["nick"] = $nick; break;
case 2: $users[$nick]["elmaname"] = substr($line, 0, strlen($line)-1); break;
case 3: $users[$nick]["country"] = substr($line, 0, strlen($line)-1); break;
case 4: $users[$nick]["team"] = substr($line, 0, strlen($line)-1); break;
case 5: $users[$nick]["pwd"] = substr($line, 0, strlen($line)-1); break;
}
}
}
$country = $users[$_GET["u"]]["country"];
$bgc = "b";
if (file_exists("img/ub" . $_GET["bg"] . ".png")) $bgc = $_GET["bg"];
$img = imagecreatefrompng("img/ub" . $bgc . ".png");
if ($str != "N/A") {
$tex = imagecreatefrompng("flags/" . $country . ".png");
list($texW, $texH, $texT, $texA) = getimagesize("flags/" . $country . ".png");
imagecopy($img, $tex, 4, 4, 0, 0, $texW, $texH);
$fontcolor = imagecolorallocate($img, 255, 255, 255);
imagestring($img, 4, 24, 1, $_GET["u"], $fontcolor);
imagestring($img, 4, 125, 1, $str, $fontcolor);
}
header("Content-Type: image/png");
imagepng($img);
imagedestroy($img);
?>