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

📄 login.cs

📁 一个供大家参考的自己做的计算机等级考试网上系统
💻 CS
字号:
using System;
using System.Data;

namespace djks
{
	/// <summary>
	/// login 的摘要说明。
	/// </summary>
	public class login
	{
		public static string Biao="admin";
		public static bool flag=false;	
		public login()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public static void lo(string usn,string pwd)
		{
			string sql="SELECT * FROM "+Biao+" where UserName='"+usn+"' and UserPassword='"+pwd+"'";
			DataTable dt=database.CreateDateSet(sql).Tables[0];
			if (dt.Rows.Count>0)
			{
				System.Web.HttpContext.Current.Session.RemoveAll();
				System.Web.HttpContext.Current.Session["admin_name_login_user"]=dt.Rows[0]["adminname"].ToString();
				System.Web.HttpContext.Current.Session["Uid"]=dt.Rows[0]["ID"];
				System.Web.HttpContext.Current.Response.Write("<script>location.href='Default.aspx';</script>");
			}
			else
			{
				hxyy_js.jsAlert("用户名和密码错误!");
			}
			
		}
		public static void chlog()
		{
			if (System.Web.HttpContext.Current.Session["Uid"]==null)
			{Out();}
			
		}

		public static void adminlo(string usn,string pwd)
		{
			string sql="SELECT * FROM admin where adminName='"+usn+"' and adminPass='"+pwd+"'";
			DataTable dt=new DataTable();
			dt=database.CreateDateSet(sql).Tables[0];
			
			if (dt.Rows.Count>0)
			{
								
				System.Web.HttpContext.Current.Session.RemoveAll();
				System.Web.HttpContext.Current.Session["admin_name_login_user"]=dt.Rows[0]["adminname"].ToString();
				//				System.Web.HttpContext.Current.Session["flag"]=true;
				System.Web.HttpContext.Current.Session["AdminUid"]=dt.Rows[0]["ID"];

				if(dt.Rows[0]["ts_purview"].ToString()=="收费员")
				{   flag=true;
					System.Web.HttpContext.Current.Response.Redirect("jsjdjksjfc.aspx");
				}
				else
				{
					System.Web.HttpContext.Current.Response.Write("<script>top.location.href='admin_main.aspx';</script>");
				}
			}
			else
			{
				flag=false;				
				//				System.Web.HttpContext.Current.Session["flag"]=false;
				hxyy_js.jsAlert("您的用户或密码错误,请核对后再登陆!");
			}
			
		}

		public static void adminch()
		{
			if (System.Web.HttpContext.Current.Session["AdminUid"]==null)
			{Out();}
			
		}
		public static void Out()
		{  
			//			System.Web.HttpContext.Current.Session["flag"]=false;
			flag=false;		
		
			System.Web.HttpContext.Current.Session.Clear();
			System.Web.HttpContext.Current.Response.Write("<script>top.location.href='../index.aspx';</script>");		
			System.Web.HttpContext.Current.Response.End();
		}
	}
	
}

⌨️ 快捷键说明

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