Exemple #1
0
    /// <summary>
    /// Sn核对
    /// </summary>
    /// <param name="ID"></param>
    /// <returns></returns>
    public static bool IsTrueSn(int ID, string Sn)
    {
        string TrueSn = Md5JiaMi.JiaMi(ID + "plusbe~!@#$%");

        if (Sn.ToLower() == TrueSn.ToLower())
        {
            return(true);
        }
        return(false);
    }
Exemple #2
0
    /// <summary>
    /// 验证用户名,密码
    /// </summary>
    /// <param name="username">用户名</param>
    /// <param name="password">密码</param>
    /// <returns></returns>
    public static Boolean VerifyPwd(string username, string password)
    {
        if (string.IsNullOrEmpty(username))
        {
            return(false);
        }
        if (string.IsNullOrEmpty(password))
        {
            return(false);
        }

        string jiaMiPass = Md5JiaMi.JiaMi(password); //加密密码

        Admin_User valueTable = new Admin_User();


        Admin_User conditionTable = new Admin_User();

        conditionTable.Name = username;
        conditionTable.Pass = jiaMiPass;
        conditionTable.AddConditon(" and States > 0");
        Admin_User admin = TableOperate <Admin_User> .GetRowData(valueTable, conditionTable);

        if (!admin.IsNull)
        {
            GetConfig();
            HttpContext.Current.Session["adminName"] = username;
            if (admin.HeadPic != null && admin.HeadPic != "")
            {
                HttpContext.Current.Session["headpic"] = SysConfig.headpicfile + admin.HeadPic;
            }
            HttpContext.Current.Session["adminFullName"] = admin.FullName;
            HttpContext.Current.Session["adminLevel"]    = admin.UserLevel;
            HttpContext.Current.Session["adminID"]       = admin.ID;
            HttpContext.Current.Session["ExhibitionID"]  = admin.ExhibitionID;
            if (admin.Manage != null && admin.Manage != "")
            {
                string[] arrManage = admin.Manage.Split(',');
                HttpContext.Current.Session["adminManage"] = arrManage;
            }

            UpdateLoginDate(admin.ID); //更新最后登录时间
            string check = admin.ID + "|" + AdminJiaMi(admin.ID, admin.Pass, HttpContext.Current.Request.UserHostName, HttpContext.Current.Request.UserHostAddress);
            // CookieUserCheck = check;


            return(true);
        }
        return(false);
    }
Exemple #3
0
    public static string AdminJiaMi(int id, string pass, string host, string ip)
    {
        string str = Md5JiaMi.JiaMi(id + pass + host + ip + "UO*&^*&^(*B(*NIKGFYTFTrfTR");

        return(str);
    }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList = ExhibitionProvider.SelectAll();
        string action = GetstringKey("action");

        if (action != "save")
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                MyID = Convert.ToInt32(this.Request["iD"]);

                Admin_User condition = new Admin_User();
                if (MyID == -1)
                {
                    condition.ID = AdminMethod.AdminID;

                    states.Disabled = true;
                }
                else
                {
                    condition.ID = MyID;
                }

                news = TableOperate <Admin_User> .GetRowData(condition);

                iD.Value = Convert.ToString(news.ID);


                states.Value = Convert.ToString(news.States);
            }
            DataBind();
        }
        else
        {
            Result     result         = new Result();
            string     logbrief       = "";
            Admin_User newChannelNews = new Admin_User();
            newChannelNews.ID = 0;
            newChannelNews.AutoForm(this.Page);
            string title   = newChannelNews.Name;
            string headpic = Draw.Drawing(newChannelNews.FullName, newChannelNews.FullName + "_" + newChannelNews.Name + ".png");
            newChannelNews.HeadPic = headpic;
            string pass;
            if (!string.IsNullOrEmpty(this.Request["pass"]))
            {
                pass = Convert.ToString(this.Request["pass"]);
                pass = Md5JiaMi.JiaMi(pass);     // md5加密
            }
            else
            {
                pass = Convert.ToString(this.Request["oldpass"]);
            }
            newChannelNews.Pass = pass;
            int _iD;
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                _iD = Convert.ToInt32(this.Request["iD"]);
                TableOperate <Admin_User> .Update(newChannelNews);

                result.msg = "编辑成功,等待返回列表";
                logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了为【" + title + "】的管理员";
            }
            else
            {
                string name = Convert.ToString(Request["name"]);
                name = RequestString.NoHTML(name);
                if (AdminMethod.IsName(name))
                {
                    result.msg           = "用户已存在";
                    Response.ContentType = "text/json";
                    Response.Write(new JavaScriptSerializer().Serialize(result));
                    Response.End();
                    return;
                }
                else
                {
                    newChannelNews.AddTime       = DateTime.Now;
                    newChannelNews.AddID         = AdminMethod.AdminID;
                    newChannelNews.LastLoginTime = DateTime.Now;
                    _iD = TableOperate <Admin_User> .InsertReturnID(newChannelNews);

                    result.msg = "添加成功,等待返回列表";
                    logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了为【" + title + "】的管理员";
                }
            }


            if (_iD > 0)
            {
                result.isOk = true;
                Lognet.AddLogin(logbrief);

                if ((newChannelNews.Manage != AdminMethod.AdminManages) && AdminMethod.AdminID == newChannelNews.ID)
                {
                    AdminMethod.UpdataManage(newChannelNews.Manage);
                }
            }
            else
            {
                result.msg = "操作失败";
            }

            Response.ContentType = "text/json";
            Response.Write(new JavaScriptSerializer().Serialize(result));
            Response.End();
        }
        DataBind();
    }
Exemple #5
0
 public static string GetSn(string id)
 {
     return(Md5JiaMi.JiaMi(id + "plusbe~!@#$%2019"));
 }