无限星辰工作室-客户无限互联网动力之源
标题:
Discuz!x3.4 英文、数字、中文限制注册解决方案
[打印本页]
作者:
crx349
时间:
2018-8-17 13:46
标题:
Discuz!x3.4 英文、数字、中文限制注册解决方案
打开:\template\default\member\register.htm(第三方模板按模板路径改下)
搜索:121行左右
<div class="rfm">
<table>
<tr>
<th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
<td><input type="text" id="{$this->setting['reginput']['username']}" name="" class="px" tabindex="1" value="{echo dhtmlspecialchars($_GET[defaultusername])}" autocomplete="off" size="25" maxlength="15" required /></td>
<td class="tipcol"><i id="tip_{$this->setting['reginput']['username']}" class="p_tip">{lang register_username_tips}</i><kbd id="chk_{$this->setting['reginput']['username']}" class="p_chk"></kbd></td>
</tr>
</table>
</div>
复制代码
1.只允许英文注册
<div class="rfm">
<table width="50%">
<tr>
<th>无限星辰工作室 www.xmspace.net 『 <font color=red>只能英文注册</font> 』用户名*</th>
</tr>
</table>
</div>
<div class="rfm">
<table>
<tr>
<th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
<td><input type="text" id="{$this->setting['reginput']['username']}" name="" class="px" tabindex="1" value="{echo dhtmlspecialchars($_GET[defaultusername])}" autocomplete="off" size="25" maxlength="15" onkeyup="this.value=this.value.replace(/[^\a-\z|A-Z]/g,'')" onblur="this.value=this.value.replace(/[^\a-\z|A-Z]/g,'')" required /></td>
<td class="tipcol"><i id="tip_{$this->setting['reginput']['username']}" class="p_tip">{lang register_username_tips}</i><kbd id="chk_{$this->setting['reginput']['username']}" class="p_chk"></kbd></td>
</tr>
</table>
</div>
复制代码
2.只允许数字注册
<div class="rfm">
<table width="50%">
<tr>
<th>无限星辰工作室 www.xmspace.net 『 <font color=red>只能数字注册</font> 』用户名*</th>
</tr>
</table>
</div>
<div class="rfm">
<table>
<tr>
<th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
<td><input type="text" id="{$this->setting['reginput']['username']}" name="" class="px" tabindex="1" value="{echo dhtmlspecialchars($_GET[defaultusername])}" autocomplete="off" size="25" maxlength="15" onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" required /></td>
<td class="tipcol"><i id="tip_{$this->setting['reginput']['username']}" class="p_tip">{lang register_username_tips}</i><kbd id="chk_{$this->setting['reginput']['username']}" class="p_chk"></kbd></td>
</tr>
</table>
</div>
复制代码
3.只允许中文注册
<div class="rfm">
<table width="50%">
<tr>
<th>无限星辰工作室 www.xmspace.net 『 <font color=red>只能中文注册</font> 』用户名*</th>
</tr>
</table>
</div>
<div class="rfm">
<table>
<tr>
<th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
<td><input type="text" id="{$this->setting['reginput']['username']}" name="" class="px" tabindex="1" value="{echo dhtmlspecialchars($_GET[defaultusername])}" autocomplete="off" size="25" maxlength="15" oninput="this.value=this.value.replace(/[\u4e00-\u9fa5\d]/g,'');" required /></td>
<td class="tipcol"><i id="tip_{$this->setting['reginput']['username']}" class="p_tip">{lang register_username_tips}</i><kbd id="chk_{$this->setting['reginput']['username']}" class="p_chk"></kbd></td>
</tr>
</table>
</div>
复制代码
欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/)
Powered by Discuz! X3.4