我在做一个关于discuz的小程序。现在想把discuz注册的时候,同时注册到其他的数据表中,另一个数据表也在同一个数据库中,我是修改uc_client/model/下面的user.php文件,
function add_user($username, $password, $email, $uid = 0, $questionid = '', $answer = '', $regip = '') {
$regip = empty($regip) ? $this->base->onlineip : $regip;
$salt = substr(uniqid(rand()), -6);
$pwd = md5($password);
$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='$regip', regdate='".$this->base->time."', salt='$salt'");
$this->db->query("INSERT INTO well_user(user,pwd,type,state) values('".$username."','".$pwd."','1','1')");
$this->db->query("INSERT INTO well_userinfo(user,email) values('".$username."','".$email."')");
$uid = $this->db->insert_id();
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."memberfields SET uid='$uid'");
return $uid;
}
这是我的代码,但是在well_user和well_userinfo表里都插入不了数据,其中以下几行是我自己写的:
$pwd = md5($password);
$this->db->query("INSERT INTO well_user(user,pwd,type,state) values('".$username."','".$pwd."','1','1')");
$this->db->query("INSERT INTO well_userinfo(user,email) values('".$username."','".$email."')");
但是现在插入不进去,我想问一下,我哪里错了,是不是修改错文件了,求指点~!
|