Admin/Login.aspx.cs

(完整代码) 1KB

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 Admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        if (Session["VaildCode"].ToString().ToLower() == this.TextBox3.Text.ToLower())
        {
            SqlConnection con = new SqlConnection(SqlHelper.connstring);
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from Admin where  Aname='" + this.txtname.Text + "'and  Apwd='" + this.txtpwd.Text + "'", con);
            SqlDataReader sdr = cmd.ExecuteReader();
            if (sdr.Read())
            {
                Session["Admin"] = sdr["Aname"].ToString();

                Response.Write("<script language='javascript'>alert('登录成功欢迎使用聊天室系统');location.href='Default.aspx'</script>");

            }

            else
            {
                Response.Write("<script language='javascript'>alert('用户名或密码错误请重新登录');location.href='login.aspx'</script>");

            }
        }
        else
        {
            Response.Write("<script language='javascript'>alert('验证码错误');location.href='login.aspx'</script>");
 
        }
    }
}

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

AI 解读

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

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