关闭DiscuzX3.5注册页面的注册邮箱验证 New
原文链接https://www.cnblogs.com/tangshiguang/p/6741136.html,原文作者:唐世光转自其他平台
打开source/class/class_member.php
定位到以下代码,大概533行左右
if(!$activationauth) { $email = $email ? $email : $_GET['email']; checkemail($email); }
修改为
if(!$activationauth) { $email = strtolower(trim($_GET['email'])); if(empty($email) && $_G['setting']['forgeemail']) { $timestamp = date('YmdHis'); $_GET['email'] = $email = 'KB' . $timestamp . '@qq.com'; // 生成随机邮箱,生成邮箱以KB开头,@qq.com结尾 } checkemail($email); // 在生成邮箱后校验}
下面是原文的修改方法,先改完下面的部分,在改我上面提到的部分discuzX3.2后台关闭注册邮箱必填选项的功能。详细过程如下:步骤1:source/admincp/admincp_setting.php 文件查找:
showsetting('setting_access_register_send_register_url', 'settingnew', $setting['sendregisterurl'], 'radio');
大概是440-441行:增加以下代码:
showsetting('setting_access_register_forge_email', 'settingnew', $setting['forgeemail'], 'radio');
步骤2:打开source/language/lang_admincp.php 文件
查找: 一个邮箱只允许注册一个帐户
大概811行,增加以下代码:
'setting_access_register_forge_email' => '取消注册邮箱必填','setting_access_register_forge_email_comment' => '开启后如果用不不填写注册邮箱,将自动生成一个邮箱地址',
步骤3:修改source/class/class_member.php
大概611行:原文是:
$email = strtolower(trim($_GET['email']));if(empty($this->setting['ignorepassword'])) {if($_GET['password'] !== $_GET['password2']) { showmessage('profile_passwd_notmatch');}if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) {showmessage('profile_passwd_illegal'); } $password = $_GET['password'];} else { $password = md5(random(10)); }}
修改为(或直接替换以下:)(在原文随机码的基础上改为了KB+时间戳+@qq.com)
$email = strtolower(trim($_GET['email']));if(empty($email) && $_G['setting']['forgeemail']) { // 生成时间戳格式:年月日时分秒(例如 20250415120711) $timestamp = date('YmdHis'); // 组合随机邮箱前缀码(KB) $_GET['email'] = $email = 'KB' . $timestamp . '@qq.com';}if(empty($this->setting['ignorepassword'])) { if($_GET['password'] !== $_GET['password2']) { showmessage('profile_passwd_notmatch'); } if(!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) { showmessage('profile_passwd_illegal'); } $password = $_GET['password'];} else { $password = md5(random(10));}}
我知道答案 回答被采纳将会获得1 贡献 已有3人回答 取消注册邮箱验证,密码怎么找回,邮箱还是有点用处的。。。 手机号. chen030201 发表于 2026-1-25 14:32
手机号. 你的网站该可以使用短信?
现在个人网站无法使用短信功能了,签名那关就过不去,你用的哪个平台的
.ce-block { margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content { /* max-width:calc(100% - 50px) */ margin-left: auto; margin-right: auto;}.ce-paragraph { line-height: 1.6em; outline: none; text-indent: 2em; font-size: 16px;}.ce-paragraph--right { text-align: right;}.ce-paragraph--center { text-align: center;}.ce-paragraph--left { text-align: left;}.ce-paragraph--justify { text-align: justify;}.ce-paragraph-text-indent { text-align: justify;}.ce-paragraph:empty::before{content: attr(data-placeholder);color: #707684;font-weight: normal;opacity: 0;}/** Show placeholder at the first paragraph if Editor is empty */.codex-editor--empty .ce-block:first-child .ce-paragraph:empty::before {opacity: 1;}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph:empty::before,.codex-editor--empty .ce-block:first-child .ce-paragraph:empty:focus::before {opacity: 0;}.ce-paragraph p:first-of-type{ margin-top: 0;}.ce-paragraph p:last-of-type{ margin-bottom: 0;}.svg-icon { width: 1em; height: 1em;}.svg-icon path,.svg-icon polygon,.svg-icon rect { fill: #4691f6;}.svg-icon circle { stroke: #4691f6; stroke-width: 1;}.inline-code {background: rgba(250, 239, 240, 0.78);color: #b44437;padding: 3px 4px;border-radius: 5px;margin: 0 1px;font-family: inherit;font-size: 0.86em;font-weight: 500;letter-spacing: 0.3px;}
页:
[1]