对discuz二次开发遇到的小疑点
程序员文章站
2022-06-14 19:04:02
...
对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数据库迁移工具“Phinx”
- 详解win10下PHP的安装配置(以php5.6为...
- php Swoole实现毫秒定时计划任务(详解)
- CodeIgniter基本配置详细介绍_PHP
- 对discuz二次开发遇到的小疑点
下一篇: 测试php函数的方法_PHP