Discuz注册功能分析
Discuz注册文件链
register.php
uc_client/client.php
uc_client/control/user.php
uc_clident/mod/user.php
注册过程分析:
1、register.php
获得的变量值不再多做解释
199行左右:
$uid = uc_user_register($username, $password, $email, $questionid, $answer);//UC注册
调用函数uc_client/client.php---- uc_user_register();
2、uc_client/client.php
292行左右:
function uc_user_register($username, $password, $email, $questionid = '', $answer = '') {
return call_user_func(UC_API_FUNC, 'user', 'register', array('username'=>$username, 'password'=>$password, 'email'=>$email, 'questionid'=>$questionid, 'answer'=>$answer));
}
这样就调用了uc_client/control/user.php中的onregister()函数
自己可以查一下call_user_func()这个函数的用法
3、uc_client/control/user.php
64行左右:
function onregister() {
$this->init_input();
$username = $this->input('username');
$password =$this->input('password');
$email = $this->input('email');
$questionid = $this->input('questionid');
$answer = $this->input('answer');
if(($status = $this->_check_username($username)) < 0) {
return $status;
}
if(($status = $this->_check_email($email)) < 0) {
return $status;
}
$uid = $_ENV['user']->add_user($username, $password, $email, 0, $questionid, $answer);
return $uid;
}
找到了吧,add_user()这个函数才是真正注册获得的用户名、密码等信息
4、uc_clident/mod/user.php
106行左右:
function add_user($username, $password, $email, $uid = 0, $questionid = '', $answer = '') {
$salt = substr(uniqid(rand()), -6);
$password = md5(md5($password).$salt); //加密的密码
$sqladd = $uid ? "uid='".intval($uid)."'," : '';
$sqladd .= $questionid > 0 ? " secques='".$this->quescrypt($questionid, $answer)."'," : " secques='',";
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."members SET $sqladd username='$username', password='$password', email='$email', regip='".$this->base->onlineip."', regdate='".$this->base->time."', salt='$salt'");
$uid = $this->db->insert_id();
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."memberfields SET uid='$uid'");
return $uid;
}
修改成自己想要的加密方式就OK了