ecshop 第三方登录包(qq,人人,新浪微博,支付宝快捷)希望对大家有所帮助。
安装说明:一,解压到ecshop根目录,确保可以以例如 http://ecshop根域名/login/renren/authorize.php 访问
二,修改各登录方式文件内的各config文件里的ID 和 Key,当然你得先去各网站申请,还有修改对应回调地址等信息。
三,因为数据库的关系,用的会员信息msn字段存储第三方登录返回昵称或真实姓名,只需在后台系统设置>会员注册项设置里把“msn”改成“真实姓名”。
四,修改模板文件以添加登录按钮,有如下三个文件要修改,修改后可能需要微调css让显示更好:
1. 修改themes文件夹下flow.dwt
约790行,找到:
<input type="submit" class="bnt_blue" name="login" value="{$lang.forthwith_login}" />
<!-- {if $anonymous_buy eq 1} 是否允许未登录用户购物 -->
<input type="button" class="bnt_blue_2" value="{$lang.direct_shopping}" onclick="location.href='flow.php?step=consignee&direct_shopping=1'" />
<!-- {/if} -->
在如上代码下方加入:
<br /><br />
<a href="#" onclick='toQzoneLogin()'><img src="/login/qqlogin/qq_login.png"></a> <a href="#" onclick='toSinaWeiboLogin()'><img src="/login/sinaweibo/sinaweibo_login.png"></a><br />
<a href="#" onclick='toAlipayLogin()'><img src="/login/alipaylogin/alipay_login.png" /></a>
<a href="#" onclick='toRenrenLogin()'><img src="/login/renren/renren_login.png" /></a>
<script>
function toQzoneLogin()
{
var A=window.open("login/qqlogin/redirect_to_login.php","TencentLogin","width=450,height=320,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toSinaWeiboLogin()
{
var A=window.open("login/sinaweibo/index.php","SinaWeiboLogin","width=640,height=360,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toAlipayLogin()
{
var A=window.open("login/alipaylogin/auth_authorize.php","AlipayLogin","width=950,height=500,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toRenrenLogin()
{
var A=window.open("login/renren/authorize.php","RenrenLogin","width=800,height=600,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
</script>
2. 修改themes文件user_passport.dwt
约60行,找到:
<tr><td></td><td><a href="user.php?act=qpassword_name" class="f3">{$lang.get_password_by_question}</a> <a href="user.php?act=get_password" class="f3">{$lang.get_password_by_mail}</a></td></tr>
在如上代码下方加入:
<tr><td>使用合作网站账号登录</td><td><a href="#" onclick='toQzoneLogin()'><img src="/login/qqlogin/qq_login.png"></a> <a href="#" onclick='toSinaWeiboLogin()'><img src="/login/sinaweibo/sinaweibo_login.png"></a>
<a href="#" onclick='toAlipayLogin()'><img src="/login/alipaylogin/alipay_login.png" /></a>
<a href="#" onclick='toRenrenLogin()'><img src="/login/renren/renren_login.png" /></a>
<script>
function toQzoneLogin()
{
var A=window.open("login/qqlogin/redirect_to_login.php?type=user","TencentLogin","width=450,height=320,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toSinaWeiboLogin()
{
var A=window.open("login/sinaweibo/index.php?type=user","SinaWeiboLogin","width=640,height=360,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toAlipayLogin()
{
var A=window.open("login/alipaylogin/auth_authorize.php?type=user","AlipayLogin","width=950,height=500,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toRenrenLogin()
{
var A=window.open("login/renren/authorize.php?type=user","RenrenLogin","width=800,height=600,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
</script></td></tr>
约200行,找到:
<a href="user.php?act=login">{$lang.want_login}</a><br />
<a href="user.php?act=get_password">{$lang.forgot_password}</a>
替换为:
<a href="user.php?act=login">{$lang.want_login}</a>或<br />
<a href="#" onclick='toQzoneLogin()'><img src="/login/qqlogin/qq_login.png"></a><br />
<a href="#" onclick='toSinaWeiboLogin()'><img src="/login/sinaweibo/sinaweibo_login.png"></a><br />
<a href="#" onclick='toAlipayLogin()'><img src="/login/alipaylogin/alipay_login.png" /></a> <br /> <a href="#" onclick='toRenrenLogin()'><img src="/login/renren/renren_login.png" /></a><br />
<a href="user.php?act=get_password">{$lang.forgot_password}</a>
<script>
function toQzoneLogin()
{
var A=window.open("login/qqlogin/redirect_to_login.php?type=user","TencentLogin","width=450,height=320,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toSinaWeiboLogin()
{
var A=window.open("login/sinaweibo/index.php?type=user","SinaWeiboLogin","width=640,height=360,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toAlipayLogin()
{
var A=window.open("login/alipaylogin/auth_authorize.php?type=user","AlipayLogin","width=950,height=500,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
function toRenrenLogin()
{
var A=window.open("login/renren/authorize.php?type=user","RenrenLogin","width=800,height=600,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
}
</script>
3. 此项修改为可选。修改themes/library下member_info.lbi 文件第5行以显示第三方登录的真实姓名或昵称而不是一大串字符。
{$lang.hello},<font class="f4_b">{$user_info.username}</font>, {$lang.welcome_return}!
为
{$lang.hello}<font class="f4_b">{$user_info.msn}</font>, {$lang.welcome_return}!