UCH2.0 邮箱/用户名/手机号登录
UCH2.0 邮箱/用户名/手机号登录重要说明:如果你的UCH 站内已经有人用 Email或与手机号做为用户名的,将不适合本插件。如果你的UCH是新站或没有上述情况,请向下看
1、打开source/function_common.php
在?>之前加入//检查手机号是否有效
function ismobile($str){
return preg_match("/^(((1{1}{1})){8})$/", $str);}2、打开language/lang_showmessage.php 找到//mt.php在上面加入'no_privilege_mobile_login' =>'你必须使用身份通认证才能使用手机号登陆',3、打开source/do_login.php
找到$password = $_POST['password'];
$username = $_POST['username'];
$cookietime = intval($_POST['cookietime']);在下方加入if (isemail($username)) {
$sqlgetuser = "SELECT uid,email,emailcheck FROM ".tname("spacefield")." WHERE email='$username'";
$querygetuser = $_SGLOBAL['db']->query($sqlgetuser);
$getuserid = $_SGLOBAL['db']->fetch_array($querygetuser);
if ($getuserid['emailcheck'] == 0 && $_SGLOBAL['db']->num_rows($querygetuser) != 0) {
showmessage('no_privilege_email', 'do.php?ac='.$_SCONFIG['login_action']);
}
$getuserid = $getuserid['uid'];
$sqlgetuser = "SELECT uid,username FROM ".tname("space")." WHERE uid='$getuserid'";
$querygetuser = $_SGLOBAL['db']->query($sqlgetuser);
$getusername = $_SGLOBAL['db']->fetch_array($querygetuser);
$username = trim($getusername['username']);
}//邮箱登录
if (ismobile($username)) {
$sqlgetuser = "SELECT owner FROM ".tname("idauths")." WHERE mobile='$username'";
$querygetuser = $_SGLOBAL['db']->query($sqlgetuser);
$getuserid = $_SGLOBAL['db']->fetch_array($querygetuser);
if ($getuserid) {
$getuserid = $getuserid['owner'];
$sqlgetuser = "SELECT uid,username FROM ".tname("space")." WHERE uid='$getuserid'";
$querygetuser = $_SGLOBAL['db']->query($sqlgetuser);
$getusername = $_SGLOBAL['db']->fetch_array($querygetuser);
$username = trim($getusername['username']);
} else {
showmessage('no_privilege_mobile_login', 'do.php?ac='.$_SCONFIG['login_action']); }
}//手机号登录4、修改template/default/index.htm 与do_login.htm 办法见
http://www.ad119.cn/bbs/viewthread.php?tid=48588&extra=只需将上述地址中的
用户名或Email改成 用户名/Email/手机号就行了
5、登录UC 后台,不是UCH。 UC 注册设置禁止的用户名 增加
*@*
13*
15*
18*
确定
页:
[1]