$data,'url'=>self::$server_url.'?op=show_rand&release='.self::get_release().'&key='.urlencode($key).'&code='.urlencode(self::sys_auth("rand=$data", 'ENCODE', $key))); } /** * 验证动态口令 * @param string $sn 口令卡编号 * @param string $code 用户输入口令 * @param string $rand 随机码 */ public static function verification($sn, $code, $rand) { $key = self::get_key(); return self::_get_data('?op=verification&release='.self::get_release().'&key='.urlencode($key).'&code='.urlencode(self::sys_auth("sn=$sn&code=$code&rand=$rand", 'ENCODE', $key)), 'index.php?m=admin&c=index&a=public_card'); } /** * 请求远程数据 * @param string $url 需要请求的地址。 * @param string $backurl 返回地址 */ private static function _get_data($url, $backurl = '') { if ($data = @file_get_contents(self::$server_url.$url)) { $data = json_decode($data, true); //如果系统是GBK的系统,把UTF8转码为GBK if (pc_base::load_config('system', 'charset') == 'gbk') { $data = array_iconv($data, 'utf-8', 'gbk'); } if ($data['status'] != 1) { showmessage($data['msg'], $backurl); } else { return $data['msg']; } } else { showmessage(L('your_server_it_may_not_have_access_to').self::$server_url.L('_please_check_the_server_configuration')); } } private function sys_auth($txt, $operation = 'ENCODE', $key = '') { $key = $key ? $key : 'oqjtioxiWRWKLEQJLKj'; $txt = $operation == 'ENCODE' ? (string)$txt : base64_decode($txt); $len = strlen($key); $code = ''; for($i=0; $i