当前位置:首页 > CMS教程 > ecshop > 列表

ecshop 注册时邮箱可填可不填,选填

发布:smiling 来源: PHP粉丝网  添加日期:2014-07-19 17:02:54 浏览: 评论:0 

注册时,邮箱可选可不选,如果填写了该项,会有邮箱格式验证,是否重复等,不填写则什么都没有.

第1,打开 /themes/default/user_passport.dwt 文件,找到:

id="username_notice" style="color:#FF0000">*

修改为:

id="username_notice" style="color:#FF0000">

第2,打开 /js/user.js文件,找到下面js代码并删除掉.

1).查找 function checkEmail(email),将整个函数替换为:

  1. function checkEmail(email) 
  2.      if (email != ''
  3.   { 
  4.   var submit_disabled = false; 
  5.        if (!Utils.isEmail(email)) 
  6.       { 
  7.         document.getElementByIdx_x_x_x('email_notice').innerHTML = msg_email_format; 
  8.         submit_disabled = true; 
  9.       } 
  10.       
  11.       if( submit_disabled ) 
  12.       { 
  13.         document.forms['formUser'].elements['Submit'].disabled = 'disabled'
  14.         return false; 
  15.       } 
  16.       Ajax.call( 'user.php?act=check_email''email=' + email, check_email_callback , 'GET''TEXT', true, true ); 
  17.     } 

2).查找一下代码,并删除:

  1. if (email.length == 0) 
  2. msg += email_empty + ‘\n’; 
  3. else 
  4. if ( ! (Utils.isEmail(email))) 
  5. msg += email_invalid + ‘\n’; 

第3.打开/includes/lib_passport.php 文件找到下面的代码:

  1. if (emptyempty($email)) 
  2. $GLOBALS['err']->add($GLOBALS['_LANG']['email_empty']); 
  3. else 
  4. if (!is_email($email)) 
  5. $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['email_invalid'], htmlspecialchars($email))); 
  6. //替换为: 
  7.      // 检查email 
  8.     if (!emptyempty($email)) 
  9.    { 
  10.         if (!is_email($email)) 
  11.         { 
  12.             $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['email_invalid'], htmlspecialchars($email))); 
  13.         } 
  14.     } 

4.最后打开includes/modules/integrates/integrate.php 文件,找到:

  1. $sql = “SELECT ” . $this->field_id . 
  2. ” FROM ” . $this->table($this->user_table). 
  3. ” WHERE ” . $this->field_email . ” = ‘$email’”; 
  4. if ($this->db->getOne($sql, true) > 0) 
  5. $this->error = ERR_EMAIL_EXISTS; 
  6. return false; 
  7. //替换为: 
  8. if(!emptyempty($email)){ 
  9.             
  10.             $sql = "SELECT " . $this->field_id . 
  11.                    " FROM " . $this->table($this->user_table). 
  12.                    " WHERE " . $this->field_email . " = '$email'"
  13.             if ($this->db->getOne($sql, true) > 0) 
  14.             { 
  15.                 $this->error = ERR_EMAIL_EXISTS; 
  16.     
  17.                 return false; 
  18.             } 
  19.         } 
  20. //即OK。 

Tags: ecshop 注册邮箱 可填选项

分享到: