Modify Discuz,uchome,ucenter compatible with your own development of the pass recently slightly contact, modify some of the code, to contribute to the key part of it.
Modify Discuz,uchome,ucenter compatible with your own development pass
A few recent contacts, to modify some of the code, to contribute to the key part of it.
At present, Discuz member registration is completed in Discuz own system, then post (or MySQL direct operation, here to post) to the Ucenter database, where the member password is MD5 (MD5 (real password) + first random character Sult), MemberID is produced by Ucenter. Then get the change and save it in Discuz.
If you already have a pass system that generates IDs, save the password part on your own system and then send it back to Ucenter, then save it to Dizcuz.
Add code to uc_center/client.php
Cjjer
function Uc_user_registercjjer ($uid, $username, $password, $email, $questionid = ', $answer = ') {
Return Call_user_func (uc_api_func, ' user ', ' register ', Array (' UID ' => $uid, ' username ' => $username, ' password ' = > $password, ' email ' => $email, ' QuestionID ' => $questionid, ' answer ' => $answer));
}
function Uc_user_updatecjjer ($uid, $username, $password, $email, $questionid = ', $answer = ') {
Return Call_user_func (uc_api_func, ' user ', ' myupdate ', Array (' UID ' => $uid, ' username ' => $username, ' password ' = > $password, ' email ' => $email, ' QuestionID ' => $questionid, ' answer ' => $answer));
}
When you register, use Uc_user_registercjjer.
Add code to contol/user.php:
Rewrite by Cjjer
function Onregister () {
$this->init_input ();
$username = $this->input (' username ');
$myuserid = Intval ($this->input (' uid '));
$password = $this->input (' password ');
$email = $this->input (' email ');
$questionid = $this->input (' QuestionID ');
$answer = $this->input (' answer ');
if (($status = $this->_check_username ($username)) < 0)
(($status = $this->_check_email ($email)) < 0)
($status = $_env[' user ']->get_user_by_uid ($myuserid))
) {
Start updating Member information
$_env[' user ']->update_user ($myuserid, $username, $password, $email, $myuserid, $questionid, $answer);
return $myuserid;
}else{
$uid = $_env[' user ']->add_user ($username, $password, $email, $myuserid, $questionid, $answer);
}
return $uid;
}
function Onmyupdate () {
$this->init_input ();
$username = $this->input (' username ');
$myuserid = Intval ($this->input (' uid '));
$password = $this->input (' password ');
$email = $this->input (' email ');
$questionid = $this->input (' QuestionID ');
$answer = $this->input (' answer ');
$status = $_env[' user ']->get_user_by_uid ($myuserid);
if (! $status) {
return-1;
}
$uid = $_env[' user ']->update_user ($myuserid, $username, $password, $email, $myuserid, $questionid, $answer);
return $uid;
}
And then join in model/user.php.
function Update_user ($user _id, $username, $password, $email, $uid = 0, $questionid = ', $answer = ') {
$salt = substr (Uniqid (rand ()),-6);
$password = MD5 (MD5 ($PASSWORD). $salt);
if (! $uid) return 0;
$sqladd = $uid? "Uid= '". Intval ($uid). "', ': ';
$sqladd. = $questionid > 0? "Secques= '". $this->quescrypt ($questionid, $answer). "', ': ' secques= ', ';
Do not update the password, salt= ' $salt '
$this->db->query ("Update"). Uc_dbtablepre. " Members SET username= ' $username ', email= ' $email ' where uid= ' $uid ');
return $user _id;
}
The Add_user method to modify is:
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;
}
In this way, users registered in the Uchome can automatically map to the Discuz, and no activation is required. Direct update.
One of the key parts of the discuz system inside the include/common.inc.php is about 140 lines of authenticated user login. here. is the time to produce $sid= $discuz _pw= $discuz _secques= $discuz _uid these variables. Include your own pass, you can get through directly.
Uchome can be directly cut into the source/function_common.php function Checkauth ().