📄 main.aspx.cs
字号:
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.OleDb;
public partial class Admin_Main : MyPage
{
protected void Page_Load(object sender, EventArgs e)
{
this.ltlMessage.Text = "";
if (Session["UserName"] != null)
{
this.txtUser.Text = Session["UserName"].ToString();
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
dbh.Reset();
dbh.sqlCommand = "select * from Users where RealName=@RealName and IsAdmin=1";
dbh.AddSqlCmdParameters("RealName", this.txtUser.Text);
dbh.GetDataReader();
if (dbh.dr.Read())
{
if (dbh.dr["UserPwd"].ToString() == LeeHom.Web.Text.MD5(this.txtPwd.Text))
{
Session["Admin"] = dbh.dr["RealName"];
Session["ID"] = dbh.dr["ID"];
Session["UserName"] = dbh.dr["RealName"];
dbh.Reset();
dbh.tableName = "Users";
dbh.AddFieldParameters("LastLogin", DateTime.Now);
dbh.conditionExpress = "ID=@ID";
dbh.AddConditionParameters("ID", Session["ID"].ToString());
dbh.DataUpdate();
this.ltlMessage.Text = "<script type=\"text/javascript\">location=\"Help.aspx\"</script>";
return;
}
}
Alert(this.ltlMessage,"用户信息错误!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -