mayi-auth.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. error_reporting(32767 ^ 8);
  3. __FILE__ == '' && exit('Fatal error code: 0');
  4. define('IN_MYMPS', true);
  5. define('CURRENTDIR', dirname(__FILE__));
  6. define('MYMPS_DATA', dirname(__FILE__) . '/data');
  7. define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
  8. if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
  9. exit('Request tainting attempted.');
  10. }
  11. @set_magic_quotes_runtime(0);
  12. if (function_exists('date_default_timezone_set')) {
  13. date_default_timezone_set('Hongkong');
  14. }
  15. if (defined('DEBUG_MODE') == false) {
  16. define('DEBUG_MODE', 0);
  17. }
  18. if (PHP_VERSION < '4.1.0') {
  19. $_GET = &$HTTP_GET_VARS;
  20. $_SERVER = &$HTTP_SERVER_VARS;
  21. unset($HTTP_GET_VARS);
  22. unset($HTTP_SERVER_VARS);
  23. }
  24. $timestamp = time();
  25. $part = isset($_GET['part']) ? trim($_GET['part']) : 'authcode';
  26. $wid = isset($_GET['wid']) ? intval($_GET['wid']) : '180';
  27. $mod = isset($_GET['mod']) ? trim($_GET['mod']) : '';
  28. !in_array($part, array('authcode', 'contact')) && exit('Access Denied');
  29. if ($part == 'authcode') {
  30. include CURRENTDIR . '/include/common.fun.php';
  31. include CURRENTDIR . '/include/cache.fun.php';
  32. include CURRENTDIR . '/include/MympsVerify.fun.php';
  33. $action = isset($_GET['action']) ? trim($_GET['action']) : 'action';
  34. if ($action == 'action') {
  35. session_save_path(CURRENTDIR . '/data/sessions');
  36. session_start();
  37. }
  38. $data = read_static_cache('authcodesettings');
  39. $Line = $data['line'] ? $data['line'] : false;
  40. $Noise = $data['noise'] ? $data['noise'] : false;
  41. $Type = $data['type'];
  42. $Distort = $data['distort'];
  43. $Incline = $data['incline'];
  44. $Close = $data['close'];
  45. $Number = $data['number'];
  46. if ($action == 'action') {
  47. $_SESSION['chkcode'] = GetMympsVerify($Type, $Noise, $Line, $Distort, $Incline, true, $Close, $Number);
  48. }
  49. else {
  50. GetMympsVerify($Type, $Noise, $Line, $Distort, $Incline, false, $Close, $Number);
  51. }
  52. }
  53. else if ($part == 'contact') {
  54. $height = '24';
  55. $fontfile = CURRENTDIR . '/data/ttf/number.ttf';
  56. $strings = base64_decode(trim($_GET['strings']));
  57. $image = imagecreatetruecolor($wid, $height);
  58. imagefilledrectangle($image, 0, 0, $wid, $height, imagecolorallocate($image, 255, 255, 255));
  59. $fontcolor = imagecolorallocate($image, 255, 0, 0);
  60. imagettftext($image, 12, 0, 0, $height * 0.69999999999999996, $fontcolor, $fontfile, $strings);
  61. header('Content-type: image/png');
  62. imagepng($image);
  63. imagedestroy($image);
  64. unset($wid);
  65. unset($height);
  66. unset($strings);
  67. unset($image);
  68. unset($black);
  69. unset($white);
  70. }
  71. ?>