edtpwd.aspx.cs

(完整代码) 2KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using DbPrvd;

public partial class a_edtpwd : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
            Response.Write("<script type='text/javascript'>parent.document.location='timeout.htm';</script>");
       
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        string oldpwd = tbxoldpwd.Value;
        string newpwd = tbxnewpwd.Value;
        string cfmpwd = tbxcfmpwd.Value;



        string oripwd = string.Empty;
        string pwdQuery = "select [password] from ["+SqlHelper.Tbpre+"admin] where [username]='" + Session["User"].ToString() + "'";
        oripwd = DbPrvd.SqlHelper.ExecuteScalar(DbPrvd.SqlHelper.ConStr, CommandType.Text, pwdQuery).ToString();
        string md5pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(oldpwd.ToLower(), "MD5");
        if (md5pwd == oripwd)
        {
            string newpwd_md5 = FormsAuthentication.HashPasswordForStoringInConfigFile(newpwd.ToLower(), "MD5");
            string updateQuery = "update [" + SqlHelper.Tbpre + "admin] set [password]='" + newpwd_md5 + "' where [username]='" + Session["User"].ToString() + "'";
            int execResult = DbPrvd.SqlHelper.ExecuteNonQuery(DbPrvd.SqlHelper.ConStr, CommandType.Text, updateQuery);
            if (execResult > 0)
            {
                Response.Write("<script type='text/javascript'>alert('操作成功');document.location='edtpwd.aspx';</script>");
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert('发生错误');history.go(-1);</script>");
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('原始密码不正确');history.go(-1);</script>");
        }
    }
}

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

AI 解读 AI

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

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