Edit D:\xinhaisoft\crisis_new\App_Code\Member.cs
??sing System; using System.Data; using System.Web; using Newtonsoft.Json; /// <summary> /// ????????? /// </summary> public class Member { //private static HttpContext context = HttpContext.Current; /// <summary> /// ?????????????????????????????????????????? /// </summary> public static void CheckLogined(MemberEntity m) { if (m.Id == 0) { string url = HttpUtility.UrlEncode(HttpContext.Current.Request.Url.ToString()); HttpContext.Current.Response.Redirect("/vue/#/member/login?redirect=" + url); } } /// <summary> /// ?????????????????????????????????????????? /// </summary> public static void CheckLogined(MemberEntity m, string url) { if (m.Id == 0) { //context.Response.Write(url); //context.Response.End(); string redirect = HttpContext.Current.Request.Url.ToString(); url += "?redirect=" + redirect; HttpContext.Current.Response.Redirect(url); /*try { context.Response.Redirect(url); } catch { HttpContext.Current.Response.Write("URL:" + url); HttpContext.Current.Response.End(); //context.Response.End(); }*/ } } /// <summary> /// ?????????????????num??????????????????????????????¤??????????? /// </summary> public static void CheckRight(MemberEntity m, string num) { CheckLogined(m); if (!GetRight(m, num)) { HttpContext.Current.Response.Cookies["Message"].Value = HttpUtility.UrlEncode("????????????????????????"); HttpContext.Current.Response.Cookies["Message"].HttpOnly = true; HttpContext.Current.Response.Redirect("/inc/showmessage.aspx"); } } /// <summary> /// ????????????num??????????????????????????????????????????? /// </summary> public static bool GetRight(MemberEntity m, string num) { string[] tmparr = num.Split(','); for (int i = 0; i < tmparr.Length; i++) { if (m.Right.Substring(int.Parse(tmparr[i]) - 1, 1) == "1") { return true; } } return false; } /// <summary> /// ????????????????????? /// </summary> private static void ClearMemberCookie() { HttpContext.Current.Response.Cookies["PSYMEMBER"].Value = string.Empty; } /// <summary> /// ???ID?????????????????????null /// </summary> /// <returns></returns> public static MemberEntity GetMember(int id) { DataRow row = SqlHelper.ExecuteDataRow("select top 1 * from v_member where id=" + id); if (row == null) { return null; } else { MemberEntity m = new MemberEntity(); m.Id = (int)row["id"]; m.Number = row["number"].ToString(); m.Username = row["username"].ToString(); m.Password = (string)row["password"]; m.Nickname = row["nickname"].ToString(); m.Realname = row["realname"].ToString(); m.Sex = (bool)row["sex"]; m.Sexname = (string)row["sexname"]; m.Birthday = (DateTime)row["birthday"]; m.Age = (int)row["age"]; m.Balance = Convert.IsDBNull(row["balance"]) ? (decimal)0 : (decimal)row["balance"]; m.Type = (int)row["type"]; m.Right = row["right"].ToString(); m.Province = row["province"].ToString(); m.City = row["city"].ToString(); m.District = row["district"].ToString(); m.Grade = (int)(Convert.IsDBNull(row["grade"]) ? 0 : row["grade"]); m.IsParent = row["isparent"].ToString() == "True"; m.IsStudent = row["isstudent"].ToString() == "True"; m.IsSchoolAdmin = row["isschooladmin"].ToString() == "True"; m.Mobile = row["mobile"].ToString(); m.Face = row["face"].ToString(); m.Marriage = Convert.IsDBNull(row["marriage"]) ? (byte)0 : (byte)row["marriage"]; m.Education = Convert.IsDBNull(row["education"]) ? (byte)0 : (byte)row["education"]; m.Md5 = row["md5"].ToString(); return m; } } /// <summary> /// ???Cookie???????????ookie????????????????????????Cookie?????ember.id=0 /// </summary> /// <returns></returns> public static MemberEntity GetMember() { MemberEntity m = new MemberEntity(); if (HttpContext.Current.Request.Cookies["PSYMEMBER"] == null) { ClearMemberCookie(); m.Id = 0; } else { string cookie = HttpContext.Current.Request.Cookies["PSYMEMBER"].Value.ToString(); if (string.IsNullOrEmpty(cookie)) { ClearMemberCookie(); m.Id = 0; } else { cookie = cookie.Replace("%2E","."); string id = cookie.Split('.')[0]; string password = cookie.Split('.')[1]; if (!Common.IsInteger(id) || !Common.IsMD5(password)) { ClearMemberCookie(); m.Id = 0; } else { string sql = "select top 1 * from v_member where id=" + id + " and password='" + password + "'"; DataRow row = SqlHelper.ExecuteDataRow(sql); if (row == null) { ClearMemberCookie(); m.Id = 0; } else { m.Id = (int)row["id"]; m.Number = row["number"].ToString(); m.Username = row["username"].ToString(); m.Password = (string)row["password"]; m.Nickname = row["nickname"].ToString(); m.Realname = row["realname"].ToString(); m.Sex = (bool)row["sex"]; m.Sexname = (string)row["sexname"]; m.Birthday = (DateTime)row["birthday"]; m.Age = (int)row["age"]; m.Balance = Convert.IsDBNull(row["balance"]) ? (decimal)0 : (decimal)row["balance"]; m.Type = (int)row["type"]; m.Right = row["right"].ToString(); m.Province = row["province"].ToString(); m.City = row["city"].ToString(); m.District = row["district"].ToString(); m.Grade = (int)(Convert.IsDBNull(row["grade"]) ? 0 : row["grade"]); m.IsParent = row["isparent"].ToString() == "True"; m.IsStudent = row["isstudent"].ToString() == "True"; m.IsSchoolAdmin = row["isschooladmin"].ToString() == "True"; m.Mobile = row["mobile"].ToString(); m.Face = row["face"].ToString(); m.Marriage = Convert.IsDBNull(row["marriage"]) ? (byte)0 : (byte)row["marriage"]; m.Education = Convert.IsDBNull(row["education"]) ? (byte)0 : (byte)row["education"]; m.Md5 = row["md5"].ToString(); } } } } return m; } public Member() { } } #region ?????? public class MemberEntity { /// <summary> /// ???ID /// </summary> [JsonProperty("id")] public int Id { get; set; } /// <summary> /// ??? /// </summary> [JsonProperty("number")] public string Number { get; set; } /// <summary> /// ???????? /// </summary> [JsonProperty("username")] public string Username { get; set; } /// <summary> /// MD5??? /// </summary> [JsonProperty("password")] public string Password { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("nickname")] public string Nickname { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("realname")] public string Realname { get; set; } /// <summary> /// ??????true???false /// </summary> [JsonProperty("sex")] public bool Sex { get; set; } /// <summary> /// ??????????????? /// </summary> [JsonProperty("sexname")] public string Sexname { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("birthday")] public DateTime Birthday { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("age")] public int Age { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("balance")] public decimal Balance { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("type")] public int Type { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("right")] public string Right { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("province")] public string Province { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("city")] public string City { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("district")] public string District { get; set; } /// <summary> /// ?????mallint-short?? /// </summary> [JsonProperty("grade")] public int Grade { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("isparent")] public bool IsParent { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("isstudent")] public bool IsStudent { get; set; } /// <summary> /// ??????????? /// </summary> [JsonProperty("isschooladmin")] public bool IsSchoolAdmin { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("mobile")] public string Mobile { get; set; } /// <summary> /// ?????? /// </summary> [JsonProperty("face")] public string Face { get; set; } /// <summary> /// ????????0?????1?????2?????3?????4?????5?????6??? /// </summary> [JsonProperty("marriage")] public byte Marriage { get; set; } /// <summary> /// ?????????0?????????1?????2?????3?????4?????5??? /// </summary> [JsonProperty("education")] public byte Education { get; set; } /// <summary> /// ???MD5??? /// </summary> [JsonProperty("md5")] public string Md5 { get; set; } } #endregion
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de