fetch($_G['uid']) : array(); $_G['member'] = array_merge($_G['member'], $member_connect); } $ts = TIMESTAMP; $sKey = $_G['setting']['my_sitekey']; $params['clientIp'] = $_G['clientip']; $params['uid'] = $_G['uid']; $params['openId'] = getuserprofile('conopenid'); $params['sId'] = $_G['setting']['siteuniqueid']; $params['appId'] = $_G['setting']['connectappid']; $params['ver'] = CLOUDCAPTCHA_VER; $params['dzVersion'] = DISCUZ_VERSION; $params['sId'] = $_G['setting']['my_siteid']; ksort($params); $str = $utilService->httpBuildQuery($params, '', '&'); $sig = md5(sprintf('%s|%s|%s', $str, $sKey, $ts)); $params['ts'] = $ts; $params['sig'] = $sig; $params = $utilService->httpBuildQuery($params, '', '&'); return $params; } public function cookie_parse($line) { $cookies = array(); foreach(explode(';', $line) as $data) { $cinfo = explode('=', $data); $cinfo[0] = trim($cinfo[0]); if(!in_array($cinfo[0], array('domain', 'expires', 'path', 'secure', 'comment'))) { $cookies[$cinfo[0]] = $cinfo[1]; } } return $cookies; } public function get($refresh, $modid) { global $_G; $params = array( 'rule' => $_G['cookie']['seccloud'] ? 2 : 1, 'refresh' => $refresh ? 1 : 0, 'oper' => $modid, ); return dfsockopen(CLOUDCAPTCHA_GET_URL.'?'.captcha::generateSiteSignUrl($params)); } public function validate($code, $picSig, $fromjs, $modid) { global $_G; if(!$code || strlen($code) != 4) { return false; } $params = array( 'code' => $code, 'picSig' => $picSig, 'rule' => $_G['cookie']['seccloud'] ? 2 : 1, 'isJSReq' => $fromjs ? 1 : 0, 'oper' => $modid, ); return dfsockopen(CLOUDCAPTCHA_VALIDATE_URL.'?'.captcha::generateSiteSignUrl($params)); } public function isneed() { return dfsockopen(CLOUDCAPTCHA_ISNEED_URL.'?'.captcha::generateSiteSignUrl()) == '{"errCode":0,"res":"yes"}'; } public function report($content = array()) { $params = array( 'type' => 1, 'content' => (array)$content, ); return dfsockopen(CLOUDCAPTCHA_REPORT_URL.'?'.captcha::generateSiteSignUrl($params)); } } ?>