up_data_pwd.aspx.cs

(开头部分) 2KB

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

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

public partial class up_data_pwd : System.Web.UI.Page
{
    string str = System.Configuration.ConfigurationManager.AppSettings["str_con"].ToString(); //连接数据库
    SqlConnection con = null;
    SqlCommand cmd = null;
    public string Pwd
    {
        set { this.text_oldpwd.Text = value; }
        get { return this.text_oldpwd.Text; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {  
        L_yhm.Text = Session["login"].ToString();//显示用户名
        }
    }
    protected void but_subit_Click(object sender, EventArgs e)
    {
        string 密码 = text_oldpwd.Text.Trim();
        string 新密码 = text_newpwd.Text.Trim();
        string 确认密码 = text_okpwd.Text.Trim();
        con = new SqlConnection(str);
        con.Open();
        string oldpwd = "SELECT password FROM [dbo].[顾客信息] where username = '" + Session["login"] + "'and password = '" + text_oldpwd.Text.Trim() + "'";
        cmd = new SqlCommand(oldpwd, con);
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            string old = dr.GetString(0).Trim(); //dr["password"].ToString();
            if (old == text_oldpwd.Text.Trim())
            {
                if (text_newpwd.Text.Trim() != text_okpwd.Text.Trim())
                {
                    Response.Write("<script>alert('两次输入密码不同!')</script>");
                    text_newpwd.Text = "";
                    text_okpwd.Text = "";
                    text_newpwd.Focus();
                    return;
                }
                else
                {
                    dr.Close();
                    string str_uppwd = "UPDATE [dbo].[顾客信息] SET password ='" + text_okpwd.Text.Trim() + "' WHERE username = '" + Session["login"] + "'";
                    SqlCommand cmd1 = new SqlCommand(str_uppwd, con);
                    cmd1.ExecuteNonQuery();
                    con.Close();
                    Response.Write("<script>alert('修改成功');window.location='startPage.aspx';</script");
                }
            }

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

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

AI 解读 AI

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

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