无限星辰工作室-客户无限互联网动力之源

标题: Discuz!x3.4 英文、数字、中文限制注册解决方案 [打印本页]

作者: crx349    时间: 2018-8-17 13:46
标题: Discuz!x3.4 英文、数字、中文限制注册解决方案
打开:\template\default\member\register.htm(第三方模板按模板路径改下)
搜索:121行左右
  1. <div class="rfm">
  2.                                                                 <table>
  3.                                                                         <tr>
  4.                                                                                 <th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
  5.                                                                                 <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>
  6.                                                                                 <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>
  7.                                                                         </tr>
  8.                                                                 </table>
  9.                                                         </div>
复制代码


1.只允许英文注册

  1. <div class="rfm">
  2. <table width="50%">
  3. <tr>
  4. <th>无限星辰工作室 www.xmspace.net  『 <font color=red>只能英文注册</font> 』用户名*</th>
  5. </tr>
  6. </table>
  7. </div>
  8. <div class="rfm">
  9.                                                                 <table>
  10.                                                                         <tr>
  11.                                                                                 <th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
  12.                                                                                 <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>
  13.                                                                                 <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>
  14.                                                                         </tr>
  15.                                                                 </table>
  16.                                                         </div>
复制代码


2.只允许数字注册

  1. <div class="rfm">
  2. <table width="50%">
  3. <tr>
  4. <th>无限星辰工作室 www.xmspace.net  『 <font color=red>只能数字注册</font> 』用户名*</th>
  5. </tr>
  6. </table>
  7. </div>
  8. <div class="rfm">
  9.                                                                 <table>
  10.                                                                         <tr>
  11.                                                                                 <th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
  12.                                                                                 <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>
  13.                                                                                 <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>
  14.                                                                         </tr>
  15.                                                                 </table>
  16.                                                         </div>
复制代码

3.只允许中文注册




  1. <div class="rfm">
  2. <table width="50%">
  3. <tr>
  4. <th>无限星辰工作室 www.xmspace.net 『 <font color=red>只能中文注册</font> 』用户名*</th>
  5. </tr>
  6. </table>
  7. </div>
  8. <div class="rfm">
  9.                                                                 <table>
  10.                                                                         <tr>
  11.                                                                                 <th><span class="rq">*</span><label for="{$this->setting['reginput']['username']}">{lang username}:</label></th>
  12.                                                                                 <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>
  13.                                                                                 <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>
  14.                                                                         </tr>
  15.                                                                 </table>
  16.                                                         </div>
复制代码







欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4