Site1.Master.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace 在线考试
{
    public partial class Site1 : System.Web.UI.MasterPage
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            //
            if (!IsPostBack)
            {
                if (Session["zh"] == null)
                {
                    this.Panel1.Visible = true;
                    this.Panel2.Visible = false;
                }
                else
                {
                        this.Panel1.Visible = false;
                        this.Panel2.Visible =true;
                        this.lb_session.Text = Session["zh"].ToString();     
                }
            }
            //
        }

        protected void bt_login_Click(object sender, EventArgs e)
        {
            string zh = this.txt_zh.Text.ToString();
            string password = this.txt_mima.Text.ToString();
             string sql = "select * from hy where username='" + zh + "' and password='" + password + "'";
                DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
                int count = dt.Rows.Count;
                if (count == 0)
                {
                    Response.Write("<script language=javascript>alert('帐号密码不正确!');</script>");
                }
                else
                {
                    Session["zh"] = dt.Rows[0]["username"].ToString();
                    Session["hy_id"] = dt.Rows[0]["hy_id"].ToString();
                    Session["depart_id"] = dt.Rows[0]["depart_id"].ToString();
                    Session["name"] = dt.Rows[0]["name"].ToString();
                    Response.Redirect("index.aspx");
                }
           
            //
        }
    }
}

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

AI 解读 AI

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

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