//开始更新会员资料
$_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;
}
然后在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='',"; |