Web/admin/login.aspx.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using Maticsoft.DBUtility;
using System.Data;
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)
{
string username= this.txtname.Text;
string pwd = this.txtpwd.Text;
object obj = DbHelperOleDb.GetSingle("select number_name from tbMember where number_name='" + username + "' and PWD='" + pwd + "'");
if (obj!=null)
{
Session["user_id"] = HttpUtility.UrlEncode(obj.ToString());
HttpCookie cookie = new HttpCookie("wxcookie");
DateTime dt = DateTime.Now;
TimeSpan ts = new TimeSpan(0, 6, 0, 0, 0);//过期时间为6小时
cookie.Expires = dt.Add(ts);//设置过期时间
cookie.Values.Add("user_id", HttpUtility.UrlEncode(obj.ToString()));
Response.AppendCookie(cookie);
Response.Write("<script>alert('登录成功!');window.location.href='index.aspx';</script>");
}
else
{
Response.Write("<script>alert('用户名或密码错误!');window.location.href='login.aspx';</script>");
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。