Beispiel #1
0
        public JsonResult LoginIn(string username, string password)
        {
            StatusAttribute res = new StatusAttribute();
            DataTable       dt  = db.AccessReader("select password,ID from admins where username='******'");

            if (dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == Md5.GetMd5Word(username, password).ToString())
            {
                res.status  = true;
                res.message = "登录成功!";
                HttpContext.Session["admin"] = dt.Rows[0][1];
            }
            else
            {
                res.status  = false;
                res.message = "登录失败!用户名或密码错误...";
            }
            return(Json(res));
        }