From 27624e6c137b87663b145e013caa71d544d78d45 Mon Sep 17 00:00:00 2001 From: anomen Date: Thu, 8 Mar 2012 23:25:57 +0100 Subject: [PATCH] www-apps/gc-fallout - dev --- www-apps/gc-fallout/dev/cert.php | 9 +++++---- www-apps/gc-fallout/dev/{rules.php => custom.php} | 17 ++++++++++++++++- www-apps/gc-fallout/dev/index.php | 7 ++++--- www-apps/gc-fallout/dev/styles.css | 8 +++++--- www-apps/gc-fallout/dev/token.php | 11 ++++++++--- www-apps/gc-fallout/dev/toolbox.php | 5 +---- 6 files changed, 39 insertions(+), 18 deletions(-) rename www-apps/gc-fallout/dev/{rules.php => custom.php} (59%) diff --git a/www-apps/gc-fallout/dev/cert.php b/www-apps/gc-fallout/dev/cert.php index a3bd6aa..040ad97 100644 --- a/www-apps/gc-fallout/dev/cert.php +++ b/www-apps/gc-fallout/dev/cert.php @@ -20,8 +20,8 @@ $token = $_SERVER["QUERY_STRING"]; //echo "\n"; $U = decodeToken($token); - -// header('X-Token: ' . $token); + $skore = spocti_skore($U); +// header('X-Token: ' . $token); // DEV //$perks = explode('!', $token); @@ -48,8 +48,9 @@ for ($i=2; $i < 8; $i ++) { $text_color = imagecolorallocate($certimg, 0x00, 0xff, 0x00); $ii = chr(0xED); -imagestring($certimg, 5, 20, 10, "${U[login]}", $text_color); -imagestring($certimg, 5, 20, 30, "Pen${ii}ze: ${U[penize]} | Karma: ${U[karma]} | J${ii}dlo: ${U[jidlo]}", $text_color); +imagestring($certimg, 5, 20, 10, "${U[login]}", $text_color); +imagestring($certimg, 5, 20, 30, "Pen${ii}ze: ${U[penize]} | Karma: ${U[karma]} | J${ii}dlo: ${U[jidlo]}", $text_color); +imagestring($certimg, 5, 180, 10, "Skore $skore", $text_color); //imagejpeg($certimg, NULL, 100); imagepng($certimg); diff --git a/www-apps/gc-fallout/dev/rules.php b/www-apps/gc-fallout/dev/custom.php similarity index 59% rename from www-apps/gc-fallout/dev/rules.php rename to www-apps/gc-fallout/dev/custom.php index 226f8e1..d583c5f 100644 --- a/www-apps/gc-fallout/dev/rules.php +++ b/www-apps/gc-fallout/dev/custom.php @@ -1,14 +1,21 @@ odkaz pro zalogovani:
\n"; $token_b64 = getToken($U, array_keys_true($perky)); - $script="http://${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}${_SERVER['SCRIPT_NAME']}?$token_b64"; - $script="http://${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}/~guppy/fallout/cert.php?$token_b64"; + $script="http://${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}" . str_replace('index.php','cert.php', $_SERVER['SCRIPT_NAME']) . "?$token_b64"; +// $script="http://${_SERVER['SERVER_NAME']}:${_SERVER['SERVER_PORT']}/~guppy/fallout/cert.php?$token_b64"; //TEST // $script = 'http://guppy.zemeplocha.info:10080/~guppy/fallout/cert.php?' . implode('/', array_keys($perky)); - echo "[url=$script][/url]
\n"; +// echo "[url=$script][/url]
\n"; + echo "$token_b64
\n"; echo "\n"; // print_r(decodeToken($token_b64)); diff --git a/www-apps/gc-fallout/dev/styles.css b/www-apps/gc-fallout/dev/styles.css index 7eda15b..db64cb4 100644 --- a/www-apps/gc-fallout/dev/styles.css +++ b/www-apps/gc-fallout/dev/styles.css @@ -5,7 +5,8 @@ body { } div#input_div { - background-color: green; + color: #77ff77; + background-color: black; width : 400px; margin : auto; margin-top:60px; @@ -13,12 +14,13 @@ div#input_div { } + div#result { - background-color: #007700; + color: #77ff77; + background-color: black; width : 400px; margin : auto; margin-top:60px; - } diff --git a/www-apps/gc-fallout/dev/token.php b/www-apps/gc-fallout/dev/token.php index d7133e9..745c63a 100644 --- a/www-apps/gc-fallout/dev/token.php +++ b/www-apps/gc-fallout/dev/token.php @@ -3,7 +3,6 @@ require_once('phpseclib/AES.php'); define(SEED_LENGTH, 2); -define(PASSWORD, "my secret pass"); function base64_url_encode($input) { return strtr(base64_encode($input), '+', '_'); @@ -41,7 +40,7 @@ function aes_encrypt($pass, $plaintext) $i = 'a'; while (strlen($pass) < $size) { $pass .= $i; -// $i++; + $i++; } $aes->setKey($pass); @@ -56,7 +55,7 @@ function aes_decrypt($pass, $cipher) $i = 'a'; while (strlen($pass) < $size) { $pass .= $i; -// $i++; + $i++; } $aes->setKey($pass); @@ -101,6 +100,7 @@ function decodeToken($token) readfile('img/no.png'); die; } + header('X-Token: ' . $token_dec); $token_list = explode($sep,$token_dec); $U['seed'] = array_shift($token_list); @@ -108,6 +108,11 @@ function decodeToken($token) $U['karma'] = array_shift($token_list); $U['penize'] = array_shift($token_list); $U['jidlo'] = array_shift($token_list); + foreach($token_list as $k=> $v) { + if (empty($v)) { + unset($token_list[$k]); + } + } $U['perky'] = $token_list; return $U; diff --git a/www-apps/gc-fallout/dev/toolbox.php b/www-apps/gc-fallout/dev/toolbox.php index 13d3ef8..b9acf70 100644 --- a/www-apps/gc-fallout/dev/toolbox.php +++ b/www-apps/gc-fallout/dev/toolbox.php @@ -1,9 +1,6 @@