Demo/EmailGetpwd.aspx.cs

(完整代码) 1KB

using Demo.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Demo
{
    public partial class EmailGetpwd : Page
    {
        private string LoginId = CookieHelper.GetCookie("Aid", "LoginId");
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(LoginId))
            {
                Response.Write("<script>alert('请您先登录再操作!');window.location.href='Login.aspx';</script>");
                Response.End();
            }
        }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            string pwd = textpwd.Text;
            string email = textEmail.Text;
            string sqlda = string.Format("select id from UserInfo where email='{0}'", email);
            object isdata = DBHelper.ExecuteScalar(sqlda);
            if (isdata != null)
            {
                string sql = string.Format("update UserInfo set password='{0}' where id={1}", pwd, LoginId);
                int num1 = DBHelper.ExecuteNonQuery(sql);
                if (num1 > 0)
                {
                    CookieHelper.ClearCookie("LoginId");
                    Response.Write("<script>alert('重置成功,请重新登陆!');window.location.href='Login.aspx';</script>");
                }
                else
                {
                    Response.Write("<script>alert('重置失败!')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('邮箱错误!')</script>");
            }

        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。