网站开发 · 2025年4月23日

ecshop注册会员自动发送验证码邮件验证

ECshop的验证邮件默认只能用户登录用户中心点击发送才能收到,这里将它修改为用户注册时自动发送。

在user.php

里面的 大概235行

         if (!empty($passwd_answer) && !empty($sel_question))

         {

            $sql = ‘UPDATE ‘ . $ecs->table(’users’) . ” SET `passwd_question`=’$sel_question’, `passwd_answer`=’$passwd_answer’   WHERE `user_id`=’” . $_SESSION[‘user_id’] . “‘”;

            $db->query($sql);

         }

         $ucdata = empty($user->ucdata)? “” : $user->ucdata;

下添加

          /* 发送邮件 */

      $cfg = $_CFG[‘smtp_user’];

      if(!empty($cfg) )

      {

             $sql=”select user_id from “.$GLOBALS[‘ecs’]->table(’users’) .”where user_name = ‘$username’”;

             $user_id=$db->getOne($sql);

             send_regiter_hash ($user_id);

          }