ck/ck_editpwd.aspx.cs

(完整代码) 1KB

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;
namespace 仓库管理系统.ck
{
    public partial class ck_editpwd : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.lb_zh.Text = Session["zh"].ToString();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string password = this.txt_password.Text.ToString();
            string user = this.lb_zh.Text.ToString();
            string sql = "select * from depot where zh='" + user + "'";
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            string oldpass = dt.Rows[0]["mima"].ToString();
            if (oldpass == this.txt_oldpass.Text)
            {
                //更新新密码
                string cx = "update depot set mima='" + password + "' where zh='" + user + "'";
                int r = db.ExecuteNonQuery(cx, CommandType.Text);
                Response.Write("<script>alert('编辑成功!');location='ck_editpwd.aspx'</script>");
            }
            else
            {
                Response.Write("<script lanuage=javascript>alert('旧密码和数据库中不匹配,请重新输入');</script>");
                this.txt_oldpass.Text = "";
            }
            //
        }
    }
}

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

AI 解读 AI

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

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