Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 哪位朋友能帮我改下这段代码,谢谢了

[复制链接]
qingwu0712 发表于 2011-12-9 10:09:51 | 显示全部楼层 |阅读模式
问题描述
适用版本: Discuz! X2
浏览器: IE8 
使用模板: 官方模板
BUG地址: http://
我需要修改uc_server\model\user.php 中的add_user方法,使其在注册UC用户时,将用户同步注册到discuz中,
我试着将代码2添加到代码1中,但是表示不行,
由于我不懂php的语法,所以各位帮我看下该怎么修改,谢谢啦
代码1
function add_user($username, $password, $email, $uid = 0, $questionid = '', $answer = '', $regip = '') {
$regip = empty($regip) ? $this->base->onlineip : $regip;
$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='$regip', regdate='".$this->base->time."', salt='$salt'");
$uid = $this->db->insert_id();
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."memberfields SET uid='$uid'");
<此处添加代码2>
return $uid;
}



代码2
$time = time();
$userdata = array(
'uid' => $uid,
'username' => $username,
'password' => $password,
'email' => $email,
'adminid' => 0,
'groupid' => 10,
'regdate' => $time,
'credits' => 0,
'timeoffset' => 9999
);
DB::insert('common_member', $userdata);
$status_data = array(
'uid' => $uid,
'regip' => $regip,
'lastip' => $regip,
'lastvisit' => $time,
'lastactivity' => $time,
'lastpost' => 0,
'lastsendmail' => 0,
);
DB::insert('common_member_status', $status_data);
DB::insert('common_member_profile', array('uid' => $uid));
DB::insert('common_member_field_forum', array('uid' => $uid));
DB::insert('common_member_field_home', array('uid' => $uid));
DB::insert('common_member_count', array('uid' => $uid));
DB::query("UPDATE ".DB::table('common_setting')." SET svalue='$username' WHERE skey='lastmember'");
 楼主| qingwu0712 发表于 2011-12-9 10:28:21 | 显示全部楼层
有人会不
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-29 00:43 , Processed in 0.022605 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表