ZenCart 使用Facebook账号登陆
2013-06-26 08:47
274 查看
首先打开http://www.facebook.com/developers/apps.php 注册网站的apps,注册成功以后记住"appId" 和"secret", 这在后面需要用到.
首先到这里下载zencart 的facebook插件:
下面是详细的安装步骤:
1.备份"includes/modules/pages/login/header_php.php", "includes/modules/pages/logoff/header_php.php", 这两个文件需要覆盖到之前系统的,所以建议安装插件之前最好先备份.
2.导入SQL文件"install_sql.sql".
3.上传所有文件到服务器中.
4.编辑登录模板页面"tpl_login_default.php",添加下面代码在页面空白中
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : ‘<?php echo $facebook->getAppId(); ?>’,
session : <?php echo json_encode($session); ?>, // don’t refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe(‘auth.login’, function() {
window.location = "<?php echo zen_href_link(‘facebook’, ", ‘SSL’); ?>"
});
};
(function() {
var e = document.createElement_x(‘script’);
e.src = document.location.protocol + ‘//connect.facebook.net/en_US/all.js’;
e.async = true;
document.getElementByIdx_x(‘fb-root’).appendChild(e);
}());
</script>
<div>Have a Facebook account? <fb:login-button perms="email"></fb:login-button></div>
5.最后编辑"includes/extra_configures/facebook-config.php" , 替换 "appId" 和 "secret" 字段.
所有步骤完成以后,打开登录Sexy Shoes页面譬如http://www.batterylaptops.co.uk/index.php?main_page=login 即可以看到facebook的登录按钮.
首先到这里下载zencart 的facebook插件:
下面是详细的安装步骤:
1.备份"includes/modules/pages/login/header_php.php", "includes/modules/pages/logoff/header_php.php", 这两个文件需要覆盖到之前系统的,所以建议安装插件之前最好先备份.
2.导入SQL文件"install_sql.sql".
3.上传所有文件到服务器中.
4.编辑登录模板页面"tpl_login_default.php",添加下面代码在页面空白中
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : ‘<?php echo $facebook->getAppId(); ?>’,
session : <?php echo json_encode($session); ?>, // don’t refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe(‘auth.login’, function() {
window.location = "<?php echo zen_href_link(‘facebook’, ", ‘SSL’); ?>"
});
};
(function() {
var e = document.createElement_x(‘script’);
e.src = document.location.protocol + ‘//connect.facebook.net/en_US/all.js’;
e.async = true;
document.getElementByIdx_x(‘fb-root’).appendChild(e);
}());
</script>
<div>Have a Facebook account? <fb:login-button perms="email"></fb:login-button></div>
5.最后编辑"includes/extra_configures/facebook-config.php" , 替换 "appId" 和 "secret" 字段.
所有步骤完成以后,打开登录Sexy Shoes页面譬如http://www.batterylaptops.co.uk/index.php?main_page=login 即可以看到facebook的登录按钮.
相关文章推荐
- 新浪微博已允许海外用户使用Facebook账号登陆
- 新浪微博在香港、台湾地区已允许用户使用Facebook账号登陆
- 用facebook账号登陆到你的Magento网店
- node.js 使用域账号登陆电脑 同一域 可以访问调试项目
- Sql Server 使用windows账号无法登陆
- Kali使用setoolkit伪造网页盗取Facebook账号和密码
- 为什么任何随便输入的账号使用SYSDBA权限都能登陆oracle
- 代码段:android使用微信账号登陆
- IM开发【4】 - 使用第三方用户账号登陆Openfire
- 苹果审核拒绝理由:订阅商品必须在不同机器可共享,facebook账号需提供基本使用功能
- Android中使用sharedPreferences对登陆页面中的账号密码进行保存
- 使用文件保存数据以及在此基础上实现判断登陆账号密码匹配问题的实现
- Fedora使用root账号进行GUI登陆
- Java使用新浪微博API通过账号密码方式登陆微博的实例
- 使用curl登陆上网账号
- 让某个账号暂时无法使用口令登陆主机
- 使用jdbc+servlet进行登陆账号的认证
- springsecurity中如何做到多个用户不能使用同一个账号同时登陆系统
- 【Android】google plus、Facebook登陆sdk集成打包出aar的使用步骤