MasterPage.master.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 MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (Session["username"] == null || Session["role"] == null)
            {
                Response.Redirect("login.aspx");
            }
            else
            {
                this.Label1.Text = Convert.ToString(Session["username"]);
                this.Label2.Text = Convert.ToString(Session["role"]);
                this.Labnum.Text = Convert.ToString(Session["loginnum"]);
                this.Labtime.Text = Convert.ToString(Session["entertime"]);
                this.Label3.Text = Convert.ToString(Session["loginouttime"]);
            }
        }
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Session["username"] = "";
        Session["pwd"] = "";
        Session["role"] = "";
        System.Web.Security.FormsAuthentication.SignOut();
      SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
        cn.Open();
        SqlCommand cmd1 = new SqlCommand("update userinfo set loginouttime=getdate(),attr='离线' where id=" + Convert.ToInt32(Session["id"]), cn);
        cmd1.ExecuteNonQuery();
        cn.Close();
        Response.Redirect("login.aspx");
  
    }
}

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

AI 解读 AI

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

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