chpwd.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class UserCenter_chpwd : System.Web.UI.Page
{
    SqlConnection con = DB.getcon();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null)
        {
            Response.Write("<script laguage='javascript'>alert('请先登录!');window.location.href('../Front.aspx')</script>");
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Session["UserID"] != null)
        {
            string userid = Session["UserID"].ToString();
            string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.TextBox2.Text.Trim(), "md5").ToString().ToLower().Substring(8, 16);
            string ppwd = this.TextBox1.Text;
            string spwd;
            con.Open();
            SqlCommand cmd = new SqlCommand("select*from Users where UserID='" + userid + "'", con);

            try
            {
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    if (dr["pwd"].ToString() != pwd)
                    {
                        Response.Write("<script laguage='javascript'>alert('密码错误!');window.location.href('chpwd.aspx')</script>");
                    }
                    else
                    {
                        con.Close();

                    }
                }
                spwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(ppwd.Trim(), "md5").ToString().ToLower().Substring(8, 16);
                cmd.CommandText = "update Users set pwd='" + spwd + "' where UserID='" + userid + "'";
                con.Open();
                cmd.ExecuteNonQuery();
                Response.Write("<script laguage='javascript'>alert('修改成功!');window.location.href('login.aspx')</script>");


            }
            catch (Exception e1)
            {

            }
后面还有 11 行代码,购买后查看完整代码

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

AI 解读 AI

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

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