/** * 参数说明 全部由URL 接入参数值 目前提供参数为以下 */ public function run() { $is = $this->_context->get('I_S', ''); $iw = 'YucMedia CopyRight ' . date('Y') . ' <Local>'; $mass = $this->_context->get('mass', ''); $apiParam = $this->getApiParamValue(); if ($is != '' && $mass !== '') { $code = explode(',', YucCrypt::decrypt(base64_decode(urldecode($mass)), YucMath::erypt_key())); YucCaptcha::showComplexImage($code, 20, 5, 2, $apiParam['width'], $apiParam['height'], $apiParam['fontsize'], $iw); } else { YucCaptcha::showImgDesc('Access defined!', $iw, $apiParam['width'], $apiParam['height'], $apiParam['fontsize']); } }
//$_SESSION[my_imgcode][code]; if (strtolower($code) == strtolower($_SESSION[my_imgcode][code])) { echo 'true'; } else { echo 'false'; } break; case 'check_yuc': require_once PHPDISK_ROOT . 'yucmedia/YucCaptcha.php'; $code = trim(gpc('code', 'P', '')); if ($code) { $result = YucCaptcha::getVerifyResult(); if ($result) { echo 'true'; } else { echo YucCaptcha::getDetails() . '::' . $result; } } break; case 'check_yxm': $settings[yxm_public_key] = $settings[yxm_public_key] ? $settings[yxm_public_key] : '82393b3baca49c60e4f0ea9f7f4f5960'; require_once 'yxm/YinXiangMaLib.php'; $YinXiangMa_response = YinXiangMa_ValidResult(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']); if ($YinXiangMa_response == "true") { echo 'true'; } else { echo 'Error!'; } break; case 'chk_username': $r_username = trim(gpc('r_username', 'P', ''));
/** * 本地验证 * @param type $ssid * @param type $result * @return type */ public static function sendVerifyLocalRequest($ssid, $result) { $mass = self::context('yuc_mass', NULL, ''); $code = YucCrypt::decrypt(base64_decode(urldecode($mass)), YucMath::erypt_key()); $code = str_replace(",", "", $code); if ($code != '' && strtolower($code) === strtolower($result)) { self::$_result = 1; self::$_code = ''; self::$_details = '验证码输入正确'; } else { self::$_result = 0; self::$_code = 'E_LOCALVALID_001'; self::$_details = '验证码验证失败'; } YLog::Write('本地验证完成,输入结果为:' . $result . ';' . '', YLog::DEBUG); }
public static function showImgDesc($word, $tip = '', $width = 160, $height = 90, $fontSize = 30) { $captcha = new YucCaptcha($width, $height, 5, 1, $fontSize); $captcha->createRes(); $captcha->bgColor(); $captcha->writeDes($word); $captcha->CreateTip($tip); $captcha->bgBorder(); $captcha->output(); }