⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class_guanli_denglu.aspx.cs

📁 利用远程控制进行上课
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace RBWebEdu
{
	/// <summary>
	/// Summary description for class_guanli_denglu.
	/// </summary>
	public class class_guanli_denglu : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Image Image1;
		protected System.Web.UI.WebControls.Label cuowu;
		protected System.Web.UI.HtmlControls.HtmlInputText yonghuming;
		protected System.Web.UI.HtmlControls.HtmlInputText yonghumima;
		protected System.Web.UI.HtmlControls.HtmlInputButton queding;
		protected System.Web.UI.HtmlControls.HtmlInputButton qingkong;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			cuowu.Visible=false;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.queding.ServerClick += new System.EventHandler(this.queding_ServerClick);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void queding_ServerClick(object sender, System.EventArgs e)
		{
			if(yonghuming.Value=="")
			{
				cuowu.Visible=true;
				cuowu.Text="请输入您用户名";
			}
			else if(yonghumima.Value=="")
			{
				cuowu.Visible=true;
				cuowu.Text="请输入您的密码";
			}
			else
			{
				SqlConnection monn=new SqlConnection(Session["str_connection"].ToString());
				monn.Open();
				string mysql="select * from admin where yonghuming=@yonghuming and yonghumima=@yonghumima  ";
				SqlCommand mycommand=new SqlCommand(mysql,monn);
				mycommand.Parameters.Add(new SqlParameter("@yonghuming", SqlDbType.Char, 20));
				mycommand.Parameters["@yonghuming"].Value=yonghuming.Value.ToString();
				mycommand.Parameters.Add(new SqlParameter("@yonghumima", SqlDbType.Char, 20));
				mycommand.Parameters["@yonghumima"].Value=yonghumima.Value.ToString();
				try
				{
					SqlDataReader reader=mycommand.ExecuteReader();
					reader.Read();
					Session["free_quanxian"]=reader.GetString(2).ToString().Trim();
					Session["free_admin"]=reader.GetString(0).ToString().Trim();
					Response.Redirect("class_guanli.aspx");
					reader.Close();
					monn.Close();
				
					//					else
					//					{
					//cuowu.Visible=true;
					//cuowu.Text="您的密码输入有误!!";
					yonghumima.Value="";
					//					}
				}
				catch
				{
					Response.Write("<script>alert('您无权使用!!')</script>");
				}
			}
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -