You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
PHP
64 lines
1.4 KiB
PHP
<?php
|
|
/*
|
|
* ucenter 公共函数库
|
|
*
|
|
*/
|
|
require_once APP_PATH.'../api/config.inc.php';
|
|
require_once APP_PATH.'../api/uc_client/client.php';
|
|
|
|
|
|
|
|
/**
|
|
* Ucenter 同步注册函数
|
|
* @param string $username 用户名
|
|
* @param string $password 密码
|
|
* @param string $email 邮箱,默认用户名拼接
|
|
* @param string $questionid 安全提问索引
|
|
* @param string $answer 安全提问答案
|
|
* @param string $regip 注册ip
|
|
* @return bool true:注册成功; false:注册失败
|
|
*
|
|
*/
|
|
|
|
function cus_uc_register($username='',$password='',$email='',$questionid='',$answer='',$regip=''){
|
|
|
|
if(C('UC_OPEN')==1){//ucenter注册开启
|
|
$uid = uc_user_register($username,$password,$email,$questionid,$answer,$regip);
|
|
if($uid <= 0){//注册失败
|
|
return false;
|
|
}else{//注册成功
|
|
return true;
|
|
}
|
|
} else {//ucenter注册关闭
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Ucenter 判断用户是否存在
|
|
* @param string $username 用户名
|
|
* @return bool true:用户名可用; false:用户名不可用
|
|
*/
|
|
|
|
function cus_uc_user_check($username){
|
|
|
|
if(C('UC_OPEN')==1) {//ucenter开启
|
|
$ucresult = uc_user_checkname($username);
|
|
if($ucresult > 0) {//用户名可用
|
|
return true;
|
|
}else{//用户名不可用
|
|
return false;
|
|
}
|
|
}else{//ucenter关闭
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|