예제 #1
0
파일: login.php 프로젝트: h3len/Project
 public function logout()
 {
     $timestamp = TIMENOW;
     hg_set_cookie('user', '', $timestamp + 31536000);
     hg_set_cookie('pass', '', $timestamp + 31536000);
     hg_set_cookie('member_id', 0, $timestamp + 31536000);
     $syn = uc_user_synlogout();
     $this->Redirect($this->lang['logoutsucess'], '', 2, 0, $syn);
 }
예제 #2
0
파일: login.php 프로젝트: h3len/Project
 public function logout()
 {
     $timestamp = TIMENOW;
     hg_set_cookie('user', '', $timestamp + 31536000);
     hg_set_cookie('pass', '', $timestamp + 31536000);
     hg_set_cookie('member_id', 0, $timestamp + 31536000);
     $syn = uc_user_synlogout();
     if ($this->input['debug']) {
         echo REFERRER;
         exit;
     }
     $this->Redirect($this->lang['logoutsucess'], REFERRER, 2, 0, $syn);
 }
예제 #3
0
파일: qq_login.php 프로젝트: h3len/Project
 public function show()
 {
     $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $_SESSION['access_token'];
     $str = get_url_contents($graph_url);
     if (strpos($str, "callback") !== false) {
         $lpos = strpos($str, "(");
         $rpos = strrpos($str, ")");
         $str = substr($str, $lpos + 1, $rpos - $lpos - 1);
     }
     $user = json_decode($str);
     if (isset($user->error)) {
         echo "<h3>error:</h3>" . $user->error;
         echo "<h3>msg  :</h3>" . $user->error_description;
         exit;
     }
     //debug
     //echo("Hello " . $user->openid);
     //set openid to session
     $_SESSION["openid"] = $user->openid;
     $get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $_SESSION['access_token'] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=json";
     $info = get_url_contents($get_user_info);
     $arr = json_decode($info, true);
     $arr['openid'] = $_SESSION["openid"];
     $arr['avatar'] = str_replace('100', '', $arr['figureurl_2']);
     /*		$arr = array(
     			'nickname' => 'Yang',
     			'avatar' => str_replace('100','','http://qzapp.qlogo.cn/qzapp/206523/A2D8AE5184F0453A7F5502463CE6DD0C/100'),
     			'openid' => 'A2D8AE5184F0453A7F5502463CE6DD0C',
     		);*/
     $member = $this->mUser->qq_login($arr['nickname'], $arr['openid'], $arr['avatar']);
     $member['large_avatar'] = $member['avatar'] . '30';
     $member['middle_avatar'] = $member['avatar'] . '50';
     $member['small_avatar'] = $member['avatar'] . '100';
     $timestamp = TIMENOW;
     // uid 大于0 登录成功,-1 : 用户不存在,或者被删除   -2:密码错误  其他:未定义
     if ($member['id'] > 0) {
         //同步登录
         $ucsynlogin = uc_user_synlogin($member['id']);
         //print_r($ucsynlogin);exit;
         hg_set_cookie('user', urldecode($member['username']), $timestamp + 31536000);
         hg_set_cookie('pass', $member['password'], $timestamp + 31536000);
         hg_set_cookie('member_id', $member['id'], $timestamp + 31536000);
         //	hg_pre($_COOKIE);exit;
         $this->Redirect($this->lang['loginsucess'], '', 2, 0, $ucsynlogin);
     } else {
         $this->ReportError($this->lang['nameerror']);
     }
 }
예제 #4
0
파일: register.php 프로젝트: h3len/Project
 public function create()
 {
     $userInfo = array('email' => $this->input['email'], 'username' => $this->input['username'], 'password' => $this->input['password']);
     $ret = $this->info->createUser($userInfo);
     $user_name = addslashes($this->input['username']);
     $password = addslashes($this->input['password']);
     $email = addslashes($this->input['email']);
     include_once './uclient/client.php';
     $member = uc_user_login($user_name, $password);
     // uid 大于0 登录成功,-1 : 用户不存在,或者被删除   -2:密码错误  其他:未定义
     if ($member[0] > 0) {
         //同步登录
         $ucsynlogin = uc_user_synlogin($member[0]);
         hg_set_cookie('user', $member[1], $timestamp + 31536000);
         hg_set_cookie('pass', $member[4], $timestamp + 31536000);
         hg_set_cookie('member_id', $member[0], $timestamp + 31536000);
         $ret['script'] = $ucsynlogin;
     } else {
         $this->ReportError($this->lang['nameerror']);
     }
     echo json_encode($ret);
 }
예제 #5
0
파일: login.php 프로젝트: h3len/Project
 public function logout()
 {
     $url = $this->input['referto'] ? $this->input['referto'] : "";
     $timestamp = TIMENOW;
     hg_set_cookie('user', '', $timestamp + 31536000);
     hg_set_cookie('pass', '', $timestamp + 31536000);
     hg_set_cookie('member_id', 0, $timestamp + 31536000);
     $syn = uc_user_synlogout();
     $this->Redirect($this->lang['logoutsucess'], $url);
 }
예제 #6
0
파일: index.php 프로젝트: h3len/Project
 public function new_status_show()
 {
     $since_id = $this->input['since_id'] ? $this->input['since_id'] : 0;
     if ($since_id) {
         hg_set_cookie('since_id', $since_id, time() + 31536000);
         $statusline = $this->status->newlist_timeline($since_id - 1, $this->user['id'], 0, 0, 10);
         if (is_array($statusline)) {
             $this->tpl->addVar('statusline', $statusline);
             echo $this->tpl->outTemplate('statusline_new', 'hg_new_status');
             exit;
         }
     }
 }
예제 #7
0
파일: register.php 프로젝트: h3len/Project
 public function create()
 {
     $reffer_user = hg_get_cookie('reffer_user');
     $userInfo = array('email' => $this->input['email'], 'username' => $this->input['username'], 'password' => $this->input['password'], 'digital_tv' => $this->input['digital_tv'], 'location' => $this->input['location'], 'location_code' => $this->input['location_code'], 'invite_code' => $this->input['invite_code'], 'reffer_user' => $reffer_user, 'verifycode' => $this->input['verifycode']);
     if (!$userInfo['verifycode']) {
         echo json_encode('验证码不为空!');
         exit;
     }
     if (!$_SESSION['hg_verifycode'] || $userInfo['verifycode'] != $_SESSION['hg_verifycode']) {
         $ret = array('retcode' => '验证码不符!');
         echo json_encode($ret);
         exit;
     }
     $rets = $this->info->createUser($userInfo);
     if ($rets['register']) {
         $ret = array('retcode' => $rets['reason']);
         echo json_encode($ret);
         exit;
     }
     if ($rets['banword']) {
         $ret = array('retcode' => '有禁止词: ' . $rets[0]);
         echo json_encode($ret);
         exit;
     }
     if ($rets['user_exist']) {
         $ret = array('retcode' => '用户名已存在');
         echo json_encode($ret);
         exit;
     }
     $user_name = addslashes($this->input['username']);
     $password = addslashes($this->input['password']);
     $email = addslashes($this->input['email']);
     include_once './uclient/client.php';
     $member = uc_user_login($user_name, $password);
     // uid 大于0 登录成功,-1 : 用户不存在,或者被删除   -2:密码错误  其他:未定义
     if ($member[0] > 0) {
         //同步登录
         $ucsynlogin = uc_user_synlogin($member[0]);
         hg_set_cookie('user', $member[1], $timestamp + 31536000);
         hg_set_cookie('pass', $member[4], $timestamp + 31536000);
         hg_set_cookie('member_id', $member[0], $timestamp + 31536000);
         $ret = array();
         $ret['script'] = $ucsynlogin;
         $ret['retcode'] = 1;
         $ret['email_action'] = $rets['email_action'];
     } else {
         $ret = array('retcode' => '注册失败');
     }
     echo json_encode($ret);
 }