Home  >  Article  >  Backend Development  >  急那位老师帮小弟我看看这段代码

急那位老师帮小弟我看看这段代码

WBOY
WBOYOriginal
2016-06-13 13:37:19819browse

急啊!!那位老师帮我看看这段代码
我的意思是 不让这段代码验证:用户名和邮件地址是否匹配 输入邮箱号直接发送。用户名有没有都可以



/* 发送密码修改确认邮件 */
elseif ($action == 'send_pwd_email')
{
  include_once(ROOT_PATH . 'includes/lib_passport.php');

  /* 初始化会员用户名和邮件地址 */
  $user_name = !empty($_POST['user_name']) ? trim($_POST['user_name']) : '';
  $email = !empty($_POST['email']) ? trim($_POST['email']) : '';

  //用户名和邮件地址是否匹配
  $user_info = $user->get_user_info($user_name);

  if ($user_info && $user_info['email'] == $email)
  {
  //生成code
  //$code = md5($user_info[0] . $user_info[1]);

  $code = md5($user_info['user_id'] . $_CFG['hash_code'] . $user_info['reg_time']);
  //发送邮件的函数
  if (send_pwd_email($user_info['user_id'], $user_name, $email, $code))
  {
  show_message($_LANG['send_success'] . $email, $_LANG['back_home_lnk'], './', 'info');
  }
  else
  {
  //发送邮件出错
  show_message($_LANG['fail_send_password'], $_LANG['back_page_up'], './', 'info');
  }
  }
  else
  {
  //用户名与邮件地址不匹配
  show_message($_LANG['username_no_email'], $_LANG['back_page_up'], '', 'info');
  }
}


------解决方案--------------------
你到底是说的啥子?
不要那些验证。直接可以发送?
那么

/* 发送密码修改确认邮件 */
elseif ($action == 'send_pwd_email')
{
include_once(ROOT_PATH . 'includes/lib_passport.php');
$user_name=$_POST['user_name'];
$user_info = $user->get_user_info($user_name);
$code = md5($user_info['user_id'] . $_CFG['hash_code'] . $user_info['reg_time']);

if (send_pwd_email($user_info['user_id'], $user_name, $email, $code))
{
show_message($_LANG['send_success'] . $email, $_LANG['back_home_lnk'], './', 'info');
}
else
{
//发送邮件出错
show_message($_LANG['fail_send_password'], $_LANG['back_page_up'], './', 'info');
}
}
------解决方案--------------------
漏了一行
$email =$_POST['email'];
加到 $user_name=....下面
------解决方案--------------------
不明白

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn