kofkof 發表於 2025-3-22 21:12:25

隐藏邮箱填写输入框,生成随机邮箱注册的修改方法

<br /><br />上次反馈了全新安装的3.5版本UC后台设置允许邮箱重复注册的功能无效(老版本升级的没碰到这个问题)无人跟进,不会php也不会改,所以弄了这个html版本的,有需要的朋友可参考<br /><br /><br />以3.5为例<br />电脑版:<br />修改注册页模板:/template/default/member/register.htm<br /><br />151行:<br /><ol><li>&lt;div class=&quot;rfm&quot;&gt;</ol>修改为<br /><ol><li>&lt;div class=&quot;rfm&quot; style=&quot;display:none;&quot;&gt;<br /><li>&lt;script&gt;<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;function generateRandomEmail() {<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var username = Math.random().toString(36).substr(2, 10); // 生成随机用户名<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var domain = 'domain.com'; // 你的域名<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;var email = username + '@' + domain; // 组合成邮箱地址<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;document.getElementById('{$this-&gt;setting['reginput']['email']}').value = email; // 设置输入框的值<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&lt;/script&gt;</ol><br /><br /><br />第232行:<br /><ol><li>&lt;button class=&quot;pn pnc&quot; id=&quot;registerformsubmit&quot;</ol>修改为:<br /><ol><li>&lt;button class=&quot;pn pnc&quot; id=&quot;registerformsubmit&quot; onclick=&quot;generateRandomEmail()&quot;</ol><br /><br />手机版:<br />修改注册页模板/template/default/touch/member/register.htm<br />第32行:<br /><ol><li>&lt;li class=&quot;mli&quot;&gt;&lt;input type=&quot;email&quot;</ol>修改为:<br /><ol><li>&lt;script&gt;<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; function generateRandomEmail() {<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var username = Math.random().toString(36).substr(2, 10); // 生成随机用户名<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var domain = 'domain.com'; // 你的域名<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;var email = username + '@' + domain; // 组合成邮箱地址<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;document.getElementById('random_email').value = email; // 设置输入框的值<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; }<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;/script&gt;<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &lt;li class=&quot;mli&quot; style=&quot;display:none;&quot;&gt;&lt;input type=&quot;email&quot; id=&quot;random_email&quot;</ol><br /><br />第67行:<br /><ol><li>&lt;button value=&quot;true&quot; name=&quot;regsubmit&quot; type=&quot;submit&quot; class=&quot;formdialog pn&quot;&gt;</ol>修改为:<br /><ol><li>&lt;button onclick=&quot;generateRandomEmail()&quot; value=&quot;true&quot; name=&quot;regsubmit&quot; type=&quot;submit&quot; class=&quot;formdialog pn&quot;&gt;</ol><br /><br />保存更新缓存<br /><br />邮箱<em>, </em>注册<em>, </em>版本<em>, </em>这个<em>, </em>不会

ljt666 發表於 2025-5-4 13:05:25

大佬,隐藏是隐藏了,但是显示email地址无效是不是没生成好呀
頁: [1]
查看完整版本: 隐藏邮箱填写输入框,生成随机邮箱注册的修改方法