Exemple #1
0
 $o = new SaeTOAuthV2($_CFG['sina_appkey'], $_CFG['sina_appsecret']);
 if (!empty($code)) {
     $keys = array();
     $keys['code'] = $code;
     $keys['redirect_uri'] = "{$_CFG['wap_domain']}/connect_sina.php";
     try {
         $token = $o->getAccessToken('code', $keys);
     } catch (OAuthException $e) {
     }
 }
 $token = $token['access_token'];
 if (empty($token)) {
     exit('登录失败!token获取失败');
 } else {
     require_once QISHI_ROOT_PATH . 'include/fun_user.php';
     $uinfo = get_user_insina_access_token($token);
     if (!empty($uinfo)) {
         update_user_info($uinfo['uid']);
         if ($uinfo['utype'] == 1) {
             $userurl = "company/wap_user.php";
         } elseif ($uinfo['utype'] == 2) {
             $userurl = "personal/wap_user.php";
         }
         header("Location: {$userurl}");
     } else {
         if (!empty($_SESSION['uid']) && !empty($_SESSION['utype'])) {
             $db->query("UPDATE " . table('members') . " SET sina_access_token = '{$token}'  WHERE uid='{$_SESSION[uid]}' AND sina_access_token='' LIMIT 1");
             exit('绑定帐号成功!');
         } else {
             $_SESSION['sina_access_token'] = $token;
             header("Location:?act=reg");
Exemple #2
0
     } catch (OAuthException $e) {
     }
 }
 $token = $token['access_token'];
 $sina_v2 = new SaeTClientV2($_CFG['sina_appkey'], $_CFG['sina_appsecret'], $token);
 $aa = $sina_v2->get_uid();
 $sina_user_id = $aa['uid'];
 $info = $sina_v2->show_user_by_id($sina_user_id);
 $sina_nickname = iconv('utf-8', 'gbk', $info['screen_name']);
 if (empty($sina_user_id)) {
     $link[0]['text'] = "返回上一页";
     $link[0]['href'] = "{$_CFG['site_dir']}user/connect_sina.php";
     showmsg('登录失败!token获取失败', 0);
 } else {
     require_once QISHI_ROOT_PATH . 'include/fun_user.php';
     $uinfo = get_user_insina_access_token($sina_user_id);
     if (!empty($uinfo)) {
         update_user_info($uinfo['uid']);
         $member_url = get_member_url($_SESSION['utype']);
         header("Location: {$member_url}");
     } else {
         if (!empty($_SESSION['uid']) && !empty($_SESSION['utype'])) {
             $time = time();
             $db->query("UPDATE " . table('members') . " SET sina_access_token = '{$sina_user_id}',sina_nick = '{$sina_nickname}', sina_binding_time = '{$time}' WHERE uid='{$_SESSION[uid]}' AND sina_access_token='' LIMIT 1");
             $link[0]['text'] = "进入会员中心";
             $link[0]['href'] = get_member_url($_SESSION['utype']);
             showmsg('绑定帐号成功!', 2, $link);
         } else {
             $_SESSION['sina_access_token'] = $sina_user_id;
             $_SESSION['sina_nickname'] = $sina_nickname;
             header("Location:?act=reg");