📄 login.cs
字号:
using System;
using System.Data;
namespace sp
{
/// <summary>
/// login 的摘要说明。
/// </summary>
public class login
{ public static string Biao="Bet_userinfo";
public login()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static void lo(string usn,string pwd)
{
string sql="SELECT id FROM "+Biao+" where UserName='"+usn+"' and UserPassword='"+pwd+"'";
DataTable dt=sp.Base.ExecuteSql4Ds(sql).Tables[0];
if (dt.Rows.Count>0)
{
System.Web.HttpContext.Current.Session["Uid"]=dt.Rows[0]["ID"];
System.Web.HttpContext.Current.Response.Write("<script>location.href='Default.aspx';</script>");
}
else
{System.Web.HttpContext.Current.Response.Redirect("msg.aspx?msg=您的用户名或密码错误,请核对后再登陆!");}
}
public static void chlog()
{
if (System.Web.HttpContext.Current.Session["Uid"] == null)
{ Out(); }
}
public static void adminlo(string usn,string pwd)
{
string sql="SELECT id FROM Bet_admincenter where adminName='"+usn+"' and adminPass='"+pwd+"'";
DataTable dt=sp.Base.ExecuteSql4Ds(sql).Tables[0];
if (dt.Rows.Count>0)
{
System.Web.HttpContext.Current.Session["AdminUid"]=dt.Rows[0]["ID"];
System.Web.HttpContext.Current.Session["AdminName"] = dt.Rows[0]["ID"];
System.Web.HttpContext.Current.Response.Write("<script>top.location.href='index.htm';</script>");
}
else
{sp.Functions.JsAlerT("您的用户或密码错误,请核对后再登陆!");;}
}
/// <summary>
/// 检查是否有管理权限
/// </summary>
/// <returns></returns>
public static bool isadmin()
{
if (System.Web.HttpContext.Current.Session["AdminUid"] == null)
{ return false; }
else
{ return true; }
}
public static void adminch()
{
if (System.Web.HttpContext.Current.Session["AdminUid"] == null)
{ Out(); }
}
public static void Out()
{
System.Web.HttpContext.Current.Session.Clear();
System.Web.HttpContext.Current.Response.Write("<script>top.location.href='admin_login.aspx';</script>");
System.Web.HttpContext.Current.Response.End();
}
public static void UserOut()
{
System.Web.HttpContext.Current.Session.Clear();
System.Web.HttpContext.Current.Response.Write("<script>top.location.href='Default.aspx';</script>");
System.Web.HttpContext.Current.Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -