login1.aspx.cs
(完整代码) 1KBusing 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 login1 : System.Web.UI.Page
{
string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
data data = new data();
SqlDataReader dr;
Alert js = new Alert();
protected void Page_Load(object sender, EventArgs e)
{
//if (!IsPostBack)
//{
// if (Session["MName"] != null)
// {
// MName.Text = Session["MName"].ToString();
// }
//}
}
private void chkADmin()
{
if (txtMName.Text == "" && txtMPwd.Text == "")
{
Alert.AlertAndRedirect("没有输入账号和密码!", "Login1.aspx");
}
else
{
dr = data.GetDataReader("select * from Admin where name='" + txtMName.Text.Trim() + "'and Password='" + txtMPwd.Text.Trim() + "'");
if (dr.Read())
{
Session["admin"] = dr["name"].ToString();
Response.Write("<script language=javascript>window.open('admin/Main.aspx');window.close();</script>");
}
else
{
Alert.AlertAndRedirect("管理员的账号或者密码不对请重新登陆!", "Login.aspx");
}
}
}
protected void btnEntry_Click(object sender, EventArgs e)
{
chkADmin();
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
