Beispiel #1
0
        public IActionResult Login(string username, string password)
        {
            DataTable dt = conDB.GetData($"SELECT * FROM `account` WHERE username = '******'; ");

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["password"].ToString() == EncodeString.MD5HashCryptography(password))
                {
                    HttpContext.Session.SetString("login", "1");
                    return(View("Index"));
                }
            }
            return(View());
        }
Beispiel #2
0
        public IActionResult Login(String u_name, String u_pass)
        {
            //string text;
            DataTable dt = conDB.Getdata($"Select * from `lkm_user` where u_name = '{u_name}';");

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["u_pass"].ToString() == EncodeString.MD5HashCyptography(u_pass))
                {
                    HttpContext.Session.SetString("Login", "1");
                    HttpContext.Session.SetString("username", dt.Rows[0]["u_name"].ToString());
                    //ViewBag.username = HttpContext.Session.GetString("username");
                    //_session.SetString("username", dt.Rows[0]["u_pass"].ToString());
                    return(View("Index"));
                }
            }
            return(View());
        }