Files
g.hnyhua.cn/Mtxfw.shop/Member_zhmm.aspx.cs

70 lines
2.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Mtxfw.shop
{
public partial class Member_zhmm : System.Web.UI.Page
{
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
public string Label_message = "";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
String UserId = Request.Form["txtUserId"];
String UserEmail = Request.Form["txtUserEmail"];
bool b = true;
if (String.IsNullOrEmpty(UserId) || String.IsNullOrEmpty(UserEmail))
{
b = false;
Response.Write("<script language='javascript'>alert('用户名或邮箱为空!');location.replace('/Member_zhmm.htm');</script>");
}
if (b)
{
if (!daoUser.IsExistsUserAndEmail(UserId, UserEmail))
{
b = false;
Response.Write("<script language='javascript'>alert('用户名和邮箱不符合!');location.replace('/Member_zhmm.htm');</script>");
}
else
{
DateTime dt = DateTime.Now;
string UserP = dt.Year.ToString().Substring(2, 2) + dt.Month + dt.Day + dt.Hour + dt.Minute + dt.Second + dt.Millisecond;
string EncryptUserP = Mtxfw.Utility.Security.EncryptString(UserP);
if (daoUser.UpdatePassword("password", EncryptUserP, UserId) && daoUser.UpdatePassword("password2", EncryptUserP, UserId))
{
try
{
//发送邮件
Mtxfw.Utility.Common.SendEmail(UserEmail, "找回密码", "<p>您的用户名是" + UserId + ",您的密码是" + UserP + "</p><p></p><p></p><p><a href=\"" + config.webUrl + "\">" + config.webName + "</a></p>");
Label_message = "成功发送,您的密码以及密码保护资料已发送到您的邮箱中,请查收!";
}
catch
{
Label_message = "发送失败,请稍候再试!";
}
}
else
{
Label_message = "重置密码失败,请稍候再试!";
}
}
}
}
}
}
}