示例#1
0
 public function synlogin(array $get, array $post)
 {
     $uid = $get['uid'];
     $username = $get['username'];
     if (!$this->config['api_synlogin']) {
         return self::API_RETURN_FORBIDDEN;
     }
     header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
     setcookie('Example_auth', Helper::authcode($uid . "\t" . $username, 'ENCODE'), 0, $this->config['cookie_path'], $this->config['cookie_domain'], Request::server('SERVER_PORT') == 433);
 }
示例#2
0
 public function api(UcenterNoteApi $note)
 {
     $code = Request::get('code');
     parse_str(Helper::authcode($code, 'DECODE', Config::get('ucenter.key')), $get);
     Request::server('REQUEST_TIME') - $get['time'] > 3600 && exit('Authracation has expiried');
     empty($get) && exit('Invalid Request');
     $action = $get['action'];
     $_input = file_get_contents('php://input');
     $post = $_input ? xml_unserialize($_input) : [];
     $allowActions = ['test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings', 'getcredit'];
     if (in_array($action, $allowActions)) {
         $return = call_user_func([$note, $action], $get, $post);
         return response($return);
     } else {
         return response(self::API_RETURN_FAILED);
     }
 }
示例#3
0
 protected function apiInput($data)
 {
     $s = Helper::authcode($data . '&agent=' . md5($_SERVER['HTTP_USER_AGENT']) . "&time=" . $_SERVER['REQUEST_TIME'], 'ENCODE', $this->config['key']);
     return $s;
 }