www-apps/gc-fallout - dev
[anomen-overlay.git] / www-apps / gc-fallout / dev / cert.php
bloba3bd6aac251eae6cf94f1dda5e0c54cddb1c575c
1 <?php
2 header('Content-type: image/png');
4 require_once('toolbox.php');
6 if (empty($_SERVER["QUERY_STRING"])) {
7 header('X-Error: no token');
8 readfile('img/no.png');
9 die;
12 $token = $_SERVER["QUERY_STRING"];
16 //$token = sha1_encrypt("my secret password", "$login/$klice");
17 //$token_b64 = base64_url_encode($token);
18 //$script="http://${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}${_SERVER['SCRIPT_NAME']}";
19 //echo "<tt>[url=$script?$token_b64][/url] </tt><br />\n";
20 //echo "</div>\n";
22 $U = decodeToken($token);
24 // header('X-Token: ' . $token);
25 // DEV
26 //$perks = explode('!', $token);
29 $certimg = imagecreatetruecolor(PERK_WIDTH*3+100, PERK_HEIGHT*3+100);
30 $bg = imagecolorallocate($certimg, 0xd0, 0xd0, 0xd0);
31 imagefill($certimg, 0, 0, $bg);
34 $i = 0;
35 foreach($U['perky'] as $perk) {
36 $p = imagecreatefromjpeg("perky/perk_$perk.jpg");
37 $x = ($i % 3) * PERK_WIDTH;
38 $y = floor($i / 3) * PERK_HEIGHT;
39 imagecopy($certimg, $p, $x + 50 , $y + 50, 0, 0, PERK_WIDTH, PERK_HEIGHT);
40 imagedestroy($p);
41 $i++;
44 $text_color = imagecolorallocate($certimg, 0xff, 0x00, 0x00);
45 for ($i=2; $i < 8; $i ++) {
46 imagestring($certimg, 5, PERK_WIDTH * 3 / 2, PERK_HEIGHT * ( $i / 3) , 'TEST', $text_color);
49 $text_color = imagecolorallocate($certimg, 0x00, 0xff, 0x00);
50 $ii = chr(0xED);
51 imagestring($certimg, 5, 20, 10, "${U[login]}", $text_color);
52 imagestring($certimg, 5, 20, 30, "Pen${ii}ze: ${U[penize]} | Karma: ${U[karma]} | J${ii}dlo: ${U[jidlo]}", $text_color);
54 //imagejpeg($certimg, NULL, 100);
55 imagepng($certimg);
56 imagedestroy($certimg);