对discuz二次开发遇到的小疑点
程序员文章站
2024-02-09 09:28:22
...
对discuz二次开发遇到的小问题。
我想在discuz中用户注册的时候再加一个字段,现在的问题是我找不到discuz的插入语句哦。那位大侠帮忙指点一下呢?
------解决方案--------------------
register.php
语句在register.php里改。
应该在uc_user_register函数后面。
但DZ好象是可以在后台就可以加自定义注册项的。
------解决方案--------------------
$username = isset($_G['gp_username']) ? $_G['gp_username'] : '';
$bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
$auth = $_G['gp_auth'];
$invite = getinvite();
if($_G['setting']['regstatus'] == 2 && empty($invite)) {
showmessage('not_open_registration_invite');
}
require_once libfile('function/profile');
if(!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) {
if($_G['gp_action'] == 'activation') {
$auth = explode("\t", authcode($auth, 'DECODE'));
if(FORMHASH != $auth[1]) {
showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
}
$username = $auth[0];
$activationauth = authcode("$auth[0]\t".FORMHASH, 'ENCODE');
}
$_G['referer'] = isset($_G['referer']) ? dhtmlspecialchars($_G['referer']) : dreferer();
$fromuser = !empty($fromuser) ? dhtmlspecialchars($fromuser) : '';
if($fromuid) {
$query = DB::query("SELECT username FROM ".DB::table('common_member')." WHERE uid='$fromuid'");
if(DB::num_rows($query)) {
$fromuser = dhtmlspecialchars(DB::result($query, 0));
} else {
dsetcookie('promotion');
}
}
$bbrulestxt = nl2br("\n$bbrulestxt\n\n");
if($_G['gp_action'] == 'activation') {
$auth = dhtmlspecialchars($auth);
}
if($seccodecheck) {
$seccode = random(6, 1);
}
if($_G['setting']['secqaa']['status'][1]) {
$seccode = random(1, 1) * 1000000 + substr($seccode, -6);
}
$username = dhtmlspecialchars($username);
$htmls = $settings = array();
foreach($_G['cache']['fields_required'] as $field) {
$fieldid = $field['fieldid'];
$html = profile_setting($fieldid);
if($html) {
$settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
$htmls[$fieldid] = $html;
}
}
include template('member/register');
} else {
if($bbrules && $bbrulehash != $_POST['agreebbrule']) {
showmessage('register_rules_agree');
}
$activation = array();
if(isset($_G['gp_activationauth'])) {
$activationauth = explode("\t", authcode($_G['gp_activationauth'], 'DECODE'));
if($activationauth[1] == FORMHASH && !($activation = daddslashes(uc_get_user($activationauth[0]), 1))) {
showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
}
}
if(!$activation) {
$username = addslashes(trim(dstripslashes($username)));
if(uc_get_user($username) && !DB::result_first("SELECT uid FROM ".DB::table('common_member')." WHERE username='$username'")) {
if($_G['inajax']) {
showmessage('profile_username_duplicate');
} else {
我想在discuz中用户注册的时候再加一个字段,现在的问题是我找不到discuz的插入语句哦。那位大侠帮忙指点一下呢?
------解决方案--------------------
register.php
语句在register.php里改。
应该在uc_user_register函数后面。
但DZ好象是可以在后台就可以加自定义注册项的。
------解决方案--------------------
$username = isset($_G['gp_username']) ? $_G['gp_username'] : '';
$bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : '';
$auth = $_G['gp_auth'];
$invite = getinvite();
if($_G['setting']['regstatus'] == 2 && empty($invite)) {
showmessage('not_open_registration_invite');
}
require_once libfile('function/profile');
if(!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) {
if($_G['gp_action'] == 'activation') {
$auth = explode("\t", authcode($auth, 'DECODE'));
if(FORMHASH != $auth[1]) {
showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
}
$username = $auth[0];
$activationauth = authcode("$auth[0]\t".FORMHASH, 'ENCODE');
}
$_G['referer'] = isset($_G['referer']) ? dhtmlspecialchars($_G['referer']) : dreferer();
$fromuser = !empty($fromuser) ? dhtmlspecialchars($fromuser) : '';
if($fromuid) {
$query = DB::query("SELECT username FROM ".DB::table('common_member')." WHERE uid='$fromuid'");
if(DB::num_rows($query)) {
$fromuser = dhtmlspecialchars(DB::result($query, 0));
} else {
dsetcookie('promotion');
}
}
$bbrulestxt = nl2br("\n$bbrulestxt\n\n");
if($_G['gp_action'] == 'activation') {
$auth = dhtmlspecialchars($auth);
}
if($seccodecheck) {
$seccode = random(6, 1);
}
if($_G['setting']['secqaa']['status'][1]) {
$seccode = random(1, 1) * 1000000 + substr($seccode, -6);
}
$username = dhtmlspecialchars($username);
$htmls = $settings = array();
foreach($_G['cache']['fields_required'] as $field) {
$fieldid = $field['fieldid'];
$html = profile_setting($fieldid);
if($html) {
$settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
$htmls[$fieldid] = $html;
}
}
include template('member/register');
} else {
if($bbrules && $bbrulehash != $_POST['agreebbrule']) {
showmessage('register_rules_agree');
}
$activation = array();
if(isset($_G['gp_activationauth'])) {
$activationauth = explode("\t", authcode($_G['gp_activationauth'], 'DECODE'));
if($activationauth[1] == FORMHASH && !($activation = daddslashes(uc_get_user($activationauth[0]), 1))) {
showmessage('register_activation_invalid', 'member.php?mod=logging&action=login');
}
}
if(!$activation) {
$username = addslashes(trim(dstripslashes($username)));
if(uc_get_user($username) && !DB::result_first("SELECT uid FROM ".DB::table('common_member')." WHERE username='$username'")) {
if($_G['inajax']) {
showmessage('profile_username_duplicate');
} else {
相关文章
相关视频
- 关于中英数字混的字串符分割问题_PHP教程
- 应用PHP标签模板实现什么任务_PHP教程
- php入门教程 精简版_PHP教程
- require(),include(),requi...
- 对discuz二次开发遇到的小疑点