public override object GetData() { int i = 0; string account = ""; try { account = (string)optdatas["account"]; } catch { account = ""; } string pwd = ""; try { pwd = (string)optdatas["pwd"]; } catch { pwd = ""; } string message = ""; string token = ""; try { token = (string)optdatas["token"]; } catch { token = ""; } JsonData js = new JsonData(); try { pwd = "666666"; AddJsonProperty("userinfo", ref js); var dt = tdal.public_user_login(account, BaseDal.MD5Encrype(pwd)); if (dt.Rows.Count > 0) { if (dt.Rows[0]["DeleteMark"].ToString() == "1") { i = -2; message = "此号被冻结"; js["userinfo"] = DataTableToJson(dt); } else { i = 1; message = "成功"; js["userinfo"] = DataTableToJson(dt); } } else { i = -1; message = "账号或密码错误"; js["userinfo"] = DataTableToJson(dt); } } catch (Exception ex) { JngsDal.RecordError("get_code", ex.Message); } AddJsonProperty("id", ref js); AddJsonProperty("message", ref js); js["id"] = i; js["message"] = message; return(js); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string account = ""; try { account = context.Request.Params["account"].ToString().Trim(); } catch { account = ""; } string pwd = ""; try { pwd = context.Request.Params["pwd"].ToString().Trim(); } catch { pwd = ""; } string datatype = ""; try { datatype = context.Request.Params["type"].ToString().Trim(); } catch { datatype = ""; } string result = ""; if (datatype != "login") { if (isok() == false) { result = "0x11"; //错误访问 context.Response.Write(result); return; } } switch (datatype) { case "login": { if (account != "" && pwd != "") { var dt = dal.public_user_login(account, BaseDal.MD5Encrype(pwd)); if (dt.Rows.Count > 0) { if (dt.Rows[0]["DeleteMark"].ToString() == "1") { result = "-2"; } else { context.Session.Add("account", account); context.Session["ip"] = ip_rsa.IPAddress(); context.Session["mac"] = ip_rsa.GetMacAddress(); context.Session["rsa"] = ip_rsa.Rsa(BaseDal.MD5Encrype(pwd)); context.Session["pwd"] = BaseDal.MD5Encrype(pwd); context.Session["userid"] = dt.Rows[0]["userid"].ToString(); result = "1"; } } else { result = "-1"; } } } break; case "sel": { } break; } context.Response.Write(result); }