gc-fllout
[anomen-overlay.git] / www-apps / gc-fallout / dev / cert.php
blobe0b371e5eca34a619a29c8420320c25dd3d14192
1 <?php
2 header('Content-type: image/jpeg');
4 require_once('toolbox.php');
6 if (HAVE_DEBUG) {
7 header("Cache-Control: no-cache, must-revalidate");
8 header("Expires: Fri, 01 Jan 2010 05:00:00 GMT");
9 header("Pragma: no-cache");
12 if (empty($_SERVER["QUERY_STRING"])) {
13 header('X-Error: no token');
14 readfile('img/no.png');
15 die;
18 $token = $_SERVER["QUERY_STRING"];
20 $U = decodeToken($token);
22 $C_WIDTH = PERK_WIDTH*PERK_COLS + (PERK_COLS-1)*PERK_PADDING + 2*CERT_BORDER;
23 $C_HEIGHT = PERK_HEIGHT*PERK_ROWS + (PERK_ROWS-1)*PERK_PADDING + 2*CERT_BORDER;
24 $certimg = imagecreatetruecolor($C_WIDTH, $C_HEIGHT);
25 $bg = imagecolorallocate($certimg, 0xd0, 0xd0, 0xd0);
26 $red_color = imagecolorallocate($certimg, 0xff, 0x00, 0x00);
27 $text_color = imagecolorallocate($certimg, 0x00, 0x7f, 0x00);
28 $ii = chr(0xED);
29 $aa = chr(0xE1);
30 $oo = chr(0xF3);
31 $zz = chr(0xBE);
32 $ss = chr(0xB9);
34 $pperku = count($U['perky']);
35 imagefill($certimg, 0, 0, $bg);
37 $bg_img = imagecreatefrompng("img/cert_bg.png");
38 imagecopy($certimg, $bg_img, 0, 0, 0, 0, $C_WIDTH, $C_HEIGHT);
41 $i = 0;
42 foreach($U['perky'] as $perk) {
43 if (file_exists("perky/$perk.png")) {
44 $p = imagecreatefrompng("perky/$perk.png");
46 else if (file_exists("perky/$perk.jpg")) {
47 $p = imagecreatefromjpeg("perky/$perk.jpg");
50 $x = ($i % PERK_COLS) * (PERK_WIDTH + PERK_PADDING);
51 $y = floor($i / PERK_COLS) * (PERK_HEIGHT + PERK_PADDING);
52 imagecopy($certimg, $p, $x + CERT_BORDER , $y + CERT_BORDER, 0, 0, PERK_WIDTH, PERK_HEIGHT);
53 imagedestroy($p);
54 $i++;
57 //for ($i=2; $i < 8; $i ++) {
58 // imagestring($certimg, 5, PERK_WIDTH * 3 / 2, PERK_HEIGHT * ( $i / 3) , 'TEST', $red_color);
59 //}
61 imagestring($certimg, 5, 250, 10, "${U['login']}", $red_color);
62 imagestring($certimg, 5, 550, 10, "Z${aa}tky: ${U['penize']} | Karma: ${U['karma']} | J${ii}dlo: ${U['jidlo']}", $text_color);
63 imagestring($certimg, 5, 50, 10, "Sk${oo}re ${U['skore']}", $text_color);
64 if (!empty($U['cheater'])) {
65 imagestring($certimg, 5, 900, 740, "C ${U['cheater']}", $text_color);
67 if (!empty($U['perky'])) {
68 imagestring($certimg, 5, 350, 400, "Z${ii}skano ${pperku} z 20 mo${zz}ných ocenìn${ii}/perkù", $text_color);
70 imagestring($certimg, 5, 350, 445, "Ocenìn${ii} nemusí být jen kladná a poctivì nelze získat v${ss}echny...", $text_color);
71 imagestring($certimg, 5, 350, 460, "Nìkteré perky jsou záporné a nez${ii}skáte za nì extra body", $text_color);
73 imagestring($certimg, 5, 350, 490, "Link na tento certifikát, prosím, pøilo${zz}te ke svému logu na GC.com", $text_color);
74 imagestring($certimg, 5, 410, 510, "Max score = cca 22000 pro záporáky, hodní získají o trochu ménì.", $text_color);
75 imagestring($certimg, 5, 595, 550, "It's a harsh world...", $red_color);
78 imagejpeg($certimg, NULL, 90);
79 //imagepng($certimg);
80 imagedestroy($certimg);