当前位置: 首页>>代码示例>>PHP>>正文


PHP SaeTClientV2::get_email方法代码示例

本文整理汇总了PHP中SaeTClientV2::get_email方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeTClientV2::get_email方法的具体用法?PHP SaeTClientV2::get_email怎么用?PHP SaeTClientV2::get_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SaeTClientV2的用法示例。


在下文中一共展示了SaeTClientV2::get_email方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login_weibo

 public function login_weibo()
 {
     include_once DIR_SYSTEM . 'weibo/config.php';
     include_once DIR_SYSTEM . 'weibo/saetv2.ex.class.php';
     $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
     if (isset($_GET['code'])) {
         $keys = array();
         $keys['code'] = $_GET['code'];
         $keys['redirect_uri'] = WB_CALLBACK_URL;
         try {
             $token = $o->getAccessToken('code', $keys);
         } catch (OAuthException $e) {
         }
     }
     if (isset($token) && !empty($token)) {
         $this->session->data['token'] = $token;
         setcookie('weibojs_' . $o->client_id, http_build_query($token));
         $c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
         $ms = $c->home_timeline();
         // done
         $uid_get = $c->get_uid();
         $email_get = $c->get_email();
         $uid = $uid_get['uid'];
         if (isset($email_get['error']) || !$email_get['email']) {
             $email = "";
         } else {
             $email = "&email=" . $email_get['email'];
         }
         $user_message = $c->show_user_by_id($uid);
         //根据ID获取用户等基本信息
         $uname = isset($user_message['screen_name']) ? $user_message['screen_name'] : '';
         $oauthuid = $uid;
         $sex = $user_message['gender'];
         $face = $user_message['avatar_large'];
         $row = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer WHERE `from` = 'weibo' AND oauthuid= '" . $uid . "'");
         //判定用户是否存在
         if (count($row->row) == "0") {
             $ip = $this->request->server['REMOTE_ADDR'];
             $info = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip=' . $ip);
             $info = json_decode($info, true);
             if ($info['code'] == 0) {
                 $country = $info['data']['country'];
             } else {
                 $country = '';
             }
             $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET  firstname = '" . $this->db->escape($uname) . "', sex = '" . $this->db->escape($sex) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($oauthuid)))) . "', customer_group_id = 1, ip = '" . $this->db->escape($ip) . "', status = '1', tname= '" . $this->db->escape($uname) . "', approved = 1, `from` = 'weibo', `oauthuid` = '" . $oauthuid . "', `face` = '" . $face . "', regtime = UNIX_TIMESTAMP(NOW()), date_added = NOW(),logintime= UNIX_TIMESTAMP(NOW()),country='" . $this->db->escape($country) . "' ");
             $row2 = $this->db->query("SELECT customer_id FROM " . DB_PREFIX . "customer WHERE `from` = 'weibo' AND oauthuid= '" . $oauthuid . "'");
             //SQL 范围 FROM=weibo  oauthuid
             $this->session->data['customer_id'] = $row2->row['customer_id'];
             $this->jumpurl("/index.php?route=account/reg_mail&code=微博登陆" . $email);
         } else {
             $cid = $row->row['customer_id'];
             $this->session->data['customer_id'] = $cid;
             if ($row->row['email'] == "") {
                 $this->jumpurl("/index.php?route=account/reg_mail&code=微博登陆" . $email);
             } else {
                 unset($this->session->data['guest']);
                 $this->db->query("UPDATE " . DB_PREFIX . "customer SET logintime = UNIX_TIMESTAMP(NOW()) WHERE `from` = 'weibo' AND  oauthuid= '" . $uid . "' AND oauthuid!='' LIMIT 1");
                 $this->load->model('log/customer_login');
                 $this->model_log_customer_login->addInfo($cid, 'weibo');
                 //添加日志
             }
             if (isset($_COOKIE['taobao_id']) && !empty($_COOKIE['taobao_id'])) {
                 //未登录并下单
                 $this->jumpurl('/order-snatch.html');
             } else {
                 $this->jumpurl("/index.php");
             }
         }
     } else {
         print "<script language='javascript'>alert('登录超时,請重试!');</script>";
         $this->jumpurl("index.php");
     }
 }
开发者ID:TheTypoMaster,项目名称:ACGStorm,代码行数:74,代码来源:login.php


注:本文中的SaeTClientV2::get_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。