INAPP登陆调用的FB接口
public function login_get (){
$this->load->helper ( 'auth' );
$redirectUrl = $this->input->cookie ( 'inapp_redirect', TRUE );
$redirectUrl = empty ( $redirectUrl ) ? '/index' : $redirectUrl;
// 判斷是否已登入
if ( $this->input->cookie ( 'inapp_auth', TRUE ) ) {
delete_cookie ( 'inapp_redirect' );
header ( 'Location: ' . $redirectUrl );
exit;
}
$user = $this->facebook->getUser ();
if ( $user ) { // FB 己登入
// 删除 redirect cookie
delete_cookie ( 'inapp_redirect' );
// 取得相對應的平台 uid
$params = array();
$params[ 'fbid' ] = $user;
$sp = 'CALL Member_SP_GetMemberRegInfoByFbid(?,@rtn)';
$member = $this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
//增加禁權的攔截
$status = $member[ 'status' ];
$checkStatus = $this->checkAccessBarred ( $status );
if ( ! $checkStatus )
exit ();
// 存在則寫 cookie
if ( $error_no == _SUCCESS_ ) {
// 登入 Log
$params = array();
$params[ 'uid' ] = $member[ 'uid' ];
$params[ 'appid' ] = 1000000;
$sp = 'CALL App_SP_SetAppDailyLoginLog_v2(?,?,@rtn)';
$this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
//会员积分登录时间
$this->memberBat ( $member[ 'uid' ] );
//记录登陆信息
$this->member_model->addAdminLoginLog ( $member[ 'uid' ], 1, $params[ 'appid' ] );
// 取得授權
$params = array();
$params[ 'uid' ] = $member[ 'uid' ];
$params[ 'appid' ] = 1000000;
$sp = 'CALL App_SP_SetUserApp(?,?,@rtn)';
$this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
// 產生 auth
$auth = $this->_genAuth ( authHelper_genUUID ( $member, $this->config->item ( 'inappKey' ) ) );
$this->_setAuth ( $auth );
header ( 'Location: ' . $redirectUrl );
exit;
}
// 不存在則取得 FB 相關個人資料
$fbuser_profile = $this->facebook->api ( '/me' );
// 寫入 Member DB
$params = array();
$params[ 'fbid' ] = $fbuser_profile[ 'id' ];
$params[ 'name' ] = empty ( $fbuser_profile[ 'name' ] ) ? '' : $fbuser_profile[ 'name' ];
$params[ 'link' ] = empty ( $fbuser_profile[ 'link' ] ) ? '' : $fbuser_profile[ 'link' ];
$params[ 'birthday' ] = empty ( $fbuser_profile[ 'birthday' ] ) ? '' : $fbuser_profile[ 'birthday' ];
$params[ 'gender' ] = empty ( $fbuser_profile[ 'gender' ] ) ? '' : $fbuser_profile[ 'gender' ];
$params[ 'email' ] = empty ( $fbuser_profile[ 'email' ] ) ? '' : $fbuser_profile[ 'email' ];
$params[ 'ip' ] = $_SERVER[ "REMOTE_ADDR" ];
$sp = 'CALL Member_SP_Register(?,?,?,?,?,?,?,@rtn)';
$member = $this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
// 註冊成功
if ( $error_no == _SUCCESS_ ) {
// 登入 Log
$params = array();
$params[ 'uid' ] = $member[ 'uid' ];
$params[ 'appid' ] = 1000000;
$sp = 'CALL App_SP_SetAppDailyLoginLog_v2(?,?,@rtn)';
$this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
//会员积分登录时间
$this->memberBat ( $member[ 'uid' ] );
//记录登陆信息
$this->load->model ( 'member_model' );
$this->member_model->addAdminLoginLog ( $member[ 'uid' ], 1, $params[ 'appid' ] );
// 取得授權
$params = array();
$params[ 'uid' ] = $member[ 'uid' ];
$params[ 'appid' ] = 1000000;
$sp = 'CALL App_SP_SetUserApp(?,?,@rtn)';
$this->inapp->_query_sp ( $sp, $params, $error_no, 'row' );
// 產生 auth
$auth = $this->_genAuth ( authHelper_genUUID ( $member, $this->config->item ( 'inappKey' ) ) );
}
header ( 'Location: ' . $redirectUrl );
} else { // FB 未登入
$url = $this->facebook->getLoginUrl ( array('scope' => 'publish_stream, user_photos, email, user_birthday, user_online_presence', 'req_perms' => 5, 'fbconnect' => 0) );
header ( 'Location: ' . $url );
}
}
INAPP登陆调用的FB接口的更多相关文章
- 调用支付宝第三方接口(沙箱环境) SpringMVC+Maven
一.蚂蚁金服开放平台的操作 网址:https://open.alipay.com/platform/home.htm 支付宝扫码登陆
- 在php中调用以及编写接口(转)
如: http://localhost/openUser.php?act=get_user_list&type=json 在这里openUser.php相当于一个接口,其中get_user_l ...
- python接口自动化(三十五)-封装与调用--流程类接口关联(详解)
简介 流程相关的接口,主要用 session 关联,如果写成函数(如上篇),s 参数每个函数都要带,每个函数多个参数,这时候封装成类会更方便.在这里我们还是以博客园为例,带着小伙伴们实践一下. 接口封 ...
- 如何请求一个需要登陆才能访问的接口(基于cookie)---apipost
在后台在开发.调试接口时,常常会遇到需要登陆才能请求的接口. 比如:获取登陆用户的收藏列表,此时,我们就需要模拟登陆状态进行接口调试了.如图: 今天,我们讲解利用ApiPost的环境变量,解决这种需要 ...
- java调用CXF WebService接口的两种方式
通过http://localhost:7002/card/services/HelloWorld?wsdl访问到xml如下,说明接口写对了. 2.静态调用 // 创建WebService客户端代理工厂 ...
- java获取https网站证书,附带调用https:webservice接口
一.java 获取https网站证书: 1.创建一个java工程,新建InstallCert类,将以下代码复制进去 package com; import java.io.BufferedReader ...
- asp.net mvc 如何调用微信jssdk接口:分享到微信朋友(圈)| 分享到qq空间
如何在asp.net mvc 项目里, 调用微信jssdk接口,现实功能: 分享到微信朋友(圈)| 分享到qq空间 1 创建一个Action,准备一些数据,初始化数据(签名): /// <sum ...
- 关于微信网页调用js-sdk相关接口注意事项目(一级域名与二级域名互相干扰!!!)
不知道有没有网友遇到过同一个web应用用不同的域名(一级或二级域名)在两个公众号中调用JSSDK相关接口实现功能, 这种做法本来没有问题,问题在于用二级域名(同属一级域名下的二级域名)绑定另一个web ...
- JS调用腾讯接口获取天气
想做个直接通过JS获取某个城市的天气.本来想通过直接调用中国气象网的接口: http://www.weather.com.cn/weather/101070201.shtml,但是跨域问题一直无法解决 ...
随机推荐
- leetcode刷题——排序
知识点 CS-Notes 备忘-必备算法 题目 冒泡排序 插入排序 归并排序 选择排序 快速排序 希尔排序 堆排序 桶排序 题解 CS-Notes awesome-algorithm
- 关于Linux下使用expdp和impdp命令对Oracle数据库进行导入和导出操作
说明:本次导入和导出采用expdp和impdp命令进行操作,这2个命令均需要在服务器端进行操作 http://www.cnblogs.com/huacw/p/3888807.html 一. 从O ...
- spring配置datasource三种方式 数据库连接池
尊重原创(原文链接):http://blog.csdn.net/kunkun378263/article/details/8506355 1.使用org.springframework.jdbc.da ...
- Java-获取Class对象的名称
package com.tj; public class MyClass2 { public static void main(String[] args) { Class cls = java.la ...
- Appium+python自动化-环境搭建
一.前言 本文是在windows10 X64系统下搭建appium,流程如下: 1.安装jdk1.8+python3.6 (64位) 2.安装node.js 3.安装Appium-desktop 4 ...
- Java包(package)详解
java包的作用是为了区别类名的命名空间 1.把功能相似或相关的类或接口组织在同一个包中,方便类的查找和使用.. 2.如同文件夹一样,包也采用了树形目录的存储方式.同一个包中的类名字是不同的,不同的包 ...
- IS-IS IGP
is-is 是igp的一种 属于osi的协议 OSI的三层是网络层 包含两种服务 一种是面向连接服务CONS 另一种是无连接服务CLNS CLNS中包含CLNP ...
- 牛腩新闻发布系统(一):SQLHelper重构(一)
导读:在机房重构的时候,就用到了SQLHelper,但那时候即使把代码反复看了很多遍,也看了注释,还和同学交流,也依然是半懂不懂.现在,我再次用到了SQLhelper这个东西,就来说说SQLHelpe ...
- sublime text2-text3 定义的不同浏览器的预览快捷键
sublime text3 自己定义的不同浏览器的预览快捷键突然全部失效了,搞到现在一直没闹清楚怎么回事,翻看插件发现SideBarEnhancements这插件刚更新了,快捷键也是依赖这个插件弄得. ...
- NCCloud 指令示例
http://ansrlab.cse.cuhk.edu.hk/software/nccloud/ Implementation of NCCloud in C++ (updated: August 2 ...