AdminManage/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 AdminManage_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Random randobj = new Random();
            labCode.Text = randobj.Next(1000, 10000).ToString();
        }
    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        SqlConnection sqlconn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
        sqlconn.Open();
        SqlCommand sqlcom = new SqlCommand("proAdminInfo", sqlconn);
        sqlcom.CommandType = CommandType.StoredProcedure;
        sqlcom.Parameters.Add("@AdminName", SqlDbType.VarChar, 20).Value = txtAdminName.Text.Trim();
        sqlcom.Parameters.Add("@AdminPwd", SqlDbType.VarChar, 20).Value = txtAdminPwd.Text.Trim();
        SqlDataReader read = sqlcom.ExecuteReader();
        if (txtAdminCode.Text.Trim() == labCode.Text.Trim())
        {
            if (read.Read())
            {

                Response.Redirect("AdminIndex.aspx");
            }
            else
            {
                Response.Write("<script>alert('您输入的用户名或密码错误,请重新输入!');location='javascript:history.go(-1)';</script>");
            }
        }
        else
            Response.Write("<script>alert('验证码输入有误,请重新输入!');location='javascript:history.go(-1)';</script>");
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Response.Write("<script>window.close();location='javascript:history.go(-1)';</script>");
    }
}

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

AI 解读 AI

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

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