public M_Guest_Bar FillMsg(string title, string msg, M_GuestBookCate cmode) { string base64 = StrHelper.CompressString(msg); if (base64.Length > 40000) { function.WriteErrMsg("发贴失败,原因:内容过长,请减少内容文字"); } M_UserInfo mu = tpuser_Bll.GetLogin("匿名用户");//barBll.GetUser(); M_Guest_Bar model = new M_Guest_Bar(); model.MsgType = 1; model.Status = cmode.Status > 1 ? (int)ZLEnum.ConStatus.UnAudit : (int)ZLEnum.ConStatus.Audited;//判断贴吧是否开启审核,如果是就默认设置为未审核 model.CUser = mu.UserID; model.CUName = mu.HoneyName; model.R_CUName = mu.HoneyName; model.Title = title.Trim(); model.SubTitle = GetSubTitle(ref msg); model.MsgContent = base64; model.CateID = cmode.CateID; model.IP = EnviorHelper.GetUserIP(); model.IDCode = mu.UserID <= 0 ? mu.WorkNum : mu.UserID.ToString(); string ipadd = IPScaner.IPLocation(model.IP); ipadd = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd; model.IP = model.IP + "|" + ipadd; model.Pid = 0; model.ReplyID = 0; model.ColledIDS = ""; return(model); }
private DataTable MyBind(int psize, int cpage) { M_ModelInfo modMod = modBll.SelReturnModel(pubMod.PubModelID); string where = "1=1 "; List <SqlParameter> sp = new List <SqlParameter>(); if (!string.IsNullOrEmpty(skey.Value)) { if (!IsExistInFieldDT(skey_dp.SelectedValue)) { function.WriteErrMsg("搜索的字段不存在"); } where += " AND " + skey_dp.SelectedValue + " LIKE @skey"; sp.Add(new SqlParameter("skey", "%" + skey.Value.Trim() + "%")); } if (Status != -100) { where += " AND PubStart=" + Status; } if (ParentID > 0) { where += " AND Parentid=" + ParentID; } setting = PageSetting.Single(cpage, psize, modMod.TableName, "ID", where, "ID DESC", sp); DBCenter.SelPage(setting); foreach (DataRow dr in setting.dt.Rows) { dr["PubIP"] = dr["PubIP"] + "(" + IPScaner.IPLocation(DataConvert.CStr(dr["PubIP"])) + ")"; } RPT.ItemCount = setting.itemCount; return(setting.dt); }
public M_Guest_Bar FillBarMsg(string msg, int pid, int rid = 0) { string base64 = StrHelper.CompressString(msg); if (base64.Length > 40000) { function.WriteErrMsg("发贴失败,原因:内容过长,请减少内容文字"); } M_UserInfo mu = buser.GetLogin(); M_Guest_Bar parent = barBll.SelReturnModel(pid); M_Guest_Bar model = new M_Guest_Bar(); model.MsgType = 1; model.Status = (int)ZLEnum.ConStatus.Audited; model.CUser = mu.UserID; model.CUName = mu.HoneyName; model.R_CUName = mu.HoneyName; model.IDCode = mu.UserID <= 0 ? mu.WorkNum : mu.UserID.ToString(); model.MsgContent = base64; model.Pid = pid; model.ReplyID = rid; model.CateID = parent.CateID; model.IP = EnviorHelper.GetUserIP(); string ipadd = IPScaner.IPLocation(model.IP); ipadd = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd; model.IP = model.IP + "|" + ipadd; model.ColledIDS = ""; //AddUserExp(mu, parent.CateID, parent.Title); return(model); }
public IActionResult Pubsinfo() { int pubId = DataConvert.CLng(GetParam("PubID")); M_Pub pubMod = pubBll.SelReturnModel(pubId); if (pubMod == null) { return(WriteErr("互动模块不存在")); } if (string.IsNullOrEmpty(pubMod.PubTableName)) { return(WriteErr("互动表为空")); } ViewBag.pubMod = pubMod; ViewBag.fieldDT = GetFieldDT(pubMod.PubModelID); PageSetting setting = B_Pub_Info.SelPage(CPage, PSize, new F_PubInfo() { tbname = pubMod.PubTableName, pid = DataConvert.CLng(GetParam("ParentID")), status = DataConvert.CLng(GetParam("status"), -100), uname = GetParam("uname"), skey = GetParam("skey"), skey_field = GetParam("skey_dp") }); foreach (DataRow dr in setting.dt.Rows) { dr["PubIP"] = dr["PubIP"] + "(" + IPScaner.IPLocation(DataConvert.CStr(dr["PubIP"])) + ")"; } if (Request.IsAjaxRequest()) { return(PartialView("Pubsinfo_List", setting)); } return(View(setting)); }
public string Login(string UserName, string UserPass) { UserName = UserName.ToLower().Replace("'", ""); UserPass = MD5.Last64(MD5.Lower32(UserPass)); string text = Guid.NewGuid().ToString().Replace("-", ""); string result; using (DbOperHandler dbOperHandler = new ComData().Doh()) { dbOperHandler.Reset(); dbOperHandler.SqlCmd = string.Format("SELECT TOP 1 '1' as result,a.Id,ParentId,UserGroup,Convert(varchar(10),cast(round(Point/10.0,2) as numeric(10,2))) as Point,\r\n UserName,Money,'{0}' as SessionId,LastTime,OnTime,IP,a.IsEnable,IsGetCash,IsBet,IsTranAcc,EnableSeason,LoginId,\r\n case when b.Id is null then '0' else '1' end as IsBank,'0' as email,'0' as notice \r\n FROM N_User a left join N_UserBank b on a.Id=b.UserId\r\n where username='******' and password='******' and isDel=0", text, UserName, UserPass); DataTable dataTable = dbOperHandler.GetDataTable(); if (dataTable.Rows.Count > 0) { if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 1) { result = base.GetJsonResult(0, "您的账户存在未知问题,请于客服联系!"); } else if (Convert.ToInt32(dataTable.Rows[0]["IsEnable"].ToString()) == 2) { result = base.GetJsonResult(0, "对不起,您的网络不稳定,请重新登录!!"); } else { this.ClearSession(); Cookie.SetObj("UserId", dataTable.Rows[0]["Id"].ToString()); Cookie.SetObj("UserName", UserName); Cookie.SetObj("UserPoint", dataTable.Rows[0]["Point"].ToString()); Cookie.SetObj("SessionId", text); string clientIP = IPHelp.ClientIP; dbOperHandler.Reset(); dbOperHandler.ConditionExpress = "Id=@Id"; dbOperHandler.AddConditionParameter("@Id", dataTable.Rows[0]["Id"].ToString()); dbOperHandler.AddFieldItem("LastTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dbOperHandler.AddFieldItem("ontime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); dbOperHandler.AddFieldItem("IP", clientIP); dbOperHandler.AddFieldItem("sessionId", text); dbOperHandler.AddFieldItem("IsOnline", 1); dbOperHandler.AddFieldItem("Source", 0); dbOperHandler.Update("N_User"); dbOperHandler.Dispose(); IPScaner iPScaner = new IPScaner(); iPScaner.DataPath = HttpContext.Current.Server.MapPath("Data/qqwry.dat"); iPScaner.IP = clientIP; string address = iPScaner.IPLocation() + iPScaner.ErrMsg; string browser = HttpContext.Current.Request.Browser.Browser + " " + HttpContext.Current.Request.Browser.Version; string oSNameByUserAgent = this.GetOSNameByUserAgent(HttpContext.Current.Request.UserAgent); new LogUserLoginDAL().Save(dataTable.Rows[0]["Id"].ToString(), address, browser, oSNameByUserAgent, clientIP); result = base.ConverTableToJSON(dataTable); } } else { dbOperHandler.Dispose(); result = base.GetJsonResult(0, "登录失败,用户名或密码错误!"); } } return(result); }
public ActionResult GetIp() { //测试地址搜索#region 测试地址搜索 IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = "113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省")+1; string cityName = addre.Substring(IndexofA); // string add1=objScan //string err = objScan.ErrMsg; return Content(cityName); }
public void SaveLog(string adminid, string userid, string title, string info) { using (DbOperHandler dbOperHandler = new ComData().Doh()) { IPScaner ipScaner = new IPScaner(); ipScaner.DataPath = HttpContext.Current.Server.MapPath("/statics/database/QQWry.Dat"); ipScaner.IP = IPHelp.ClientIP; string str = ipScaner.IPLocation() + ipScaner.ErrMsg; dbOperHandler.Reset(); dbOperHandler.AddFieldItem("AdminId", (object)adminid); dbOperHandler.AddFieldItem("UserId", (object)userid); dbOperHandler.AddFieldItem("OperTitle", (object)title); dbOperHandler.AddFieldItem("OperInfo", (object)info); dbOperHandler.AddFieldItem("OperTime", (object)DateTime.Now.ToString()); dbOperHandler.AddFieldItem("OperIP", (object)IPHelp.ClientIP); dbOperHandler.Insert("Log_AdminOper"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { M_UserInfo mu = buser.GetLogin(false); this.LblUser.Text = mu.UserName; this.LblEmail.Text = mu.Email; this.LblGroup.Text = bgp.GetByID(mu.GroupID).GroupName; this.LblJoinTime.Text = mu.JoinTime.ToString(); this.LblRegTime.Text = mu.RegTime.ToString(); this.LblLoginTimes.Text = mu.LoginTimes.ToString(); this.LblLastLogin.Text = mu.LastLoginTimes.ToString(); this.LblLastIP.Text = IPScaner.IPLocation(mu.LastLoginIP); this.LblLastModify.Text = (mu.LastPwdChangeTime == mu.RegTime) ? "" : mu.LastPwdChangeTime.ToString(); this.LblLastLock.Text = (mu.LastLockTime == mu.RegTime) ? "" : mu.LastLockTime.ToString(); this.Purse_L.Text = mu.Purse.ToString(); this.Point_L.Text = mu.UserExp.ToString(); Sicon_L.Text = mu.SilverCoin.ToString(); UserPoint_L.Text = mu.UserPoint.ToString(); this.LblboffExp.Text = mu.boffExp.ToString(); this.LblConsumeExp.Text = mu.ConsumeExp.ToString(); this.DummyPurse_L.Text = mu.DummyPurse.ToString(); M_PointGrounp pointmod = pointBll.SelectPintGroup(mu.UserExp); gradeTxt.Text = ""; if (pointmod != null) { gradeTxt.Text = pointmod.GroupName; LvIcon_Span.Attributes["class"] = pointmod.ImgUrl; } if (DataConvert.CLng(mu.ParentUserID) > 0) { M_UserInfo usinfo = buser.GetSelect(Convert.ToInt32(mu.ParentUserID)); LblParentUserID.Text = string.IsNullOrEmpty(usinfo.UserName) ? "" : usinfo.UserName; } int UserModelID = DataConverter.CLng(bgp.GetGroupModel(mu.GroupID)); if (UserModelID > 0) { GroupModelField_Li.Text = Fll.InputallHtml(UserModelID, 0, new ModelConfig() { ValueDT = bmodel.SelUserModelField(UserModelID, mu.UserID) }); } } }
/// <summary> /// 执行签到/签退操作 /// </summary> /// <param name="uid"></param> /// <returns>签到记录ID,若返回值为-1说明今日已签退,此次没有进行任何操作</returns> private int Sign(M_UserInfo mu, int ZType) { M_Plat_Sign model = new M_Plat_Sign(); DateTime sdate = DataConvert.CDate("08:30"); //上班时间 DateTime edate = DataConvert.CDate("18:00"); //下班时间 model.State = 0; if (ZType == 0 && DateTime.Now > sdate) { model.State = 1; } //迟到 if (ZType == 1 && DateTime.Now < edate) { model.State = 2; } //早退 model.UserID = mu.UserID; model.IP = IPScaner.GetUserIP(); model.IPLocation = IPScaner.IPLocation(model.IP); model.ZType = ZType; return(Insert(model)); }
private M_Guest_Bar FillMsg(string title, string msg, int pid, int rid = 0, M_GuestBookCate catemod = null) { if (pid > 0) { M_Guest_Bar pmod = barBll.SelReturnModel(pid); catemod = cateBll.SelReturnModel(pmod.CateID); } string base64 = StrHelper.CompressString(msg); if (base64.Length > 40000) { throw new Exception("取消修改,原因:内容过长,请减少内容"); } M_UserInfo mu = tuBll.GetLogin("匿名用户"); //barBll.GetUser(); M_Guest_Bar model = new M_Guest_Bar(); model.MsgType = 1; model.Status = catemod.Status > 1 ? (int)ZLEnum.ConStatus.UnAudit : (int)ZLEnum.ConStatus.Audited;//判断贴吧是否开启审核,如果是就默认设置为未审核 model.CUser = mu.UserID; model.CUName = mu.HoneyName; model.R_CUName = mu.HoneyName; model.Title = title; model.SubTitle = GetSubTitle(ref msg); model.MsgContent = base64; model.CateID = catemod.CateID; model.IP = IPScaner.GetUserIP(HttpContext); string ipadd = IPScaner.IPLocation(model.IP); ipadd = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd; model.IP = model.IP + "|" + ipadd; model.Pid = pid; model.ReplyID = rid; model.ColledIDS = ""; model.IDCode = mu.UserID == 0 ? mu.WorkNum : mu.UserID.ToString(); model.CDate = DateTime.Now; return(model); }
public string GetIpLocation() { return(IPScaner.IPLocation(Eval("IP", ""), "@province|@city", true)); }
public ActionResult Save(SpeechInfoEntity model) { try { var city = ""; //统计当前发言人的发言次数 //if (Session["User"] != null) //{ // UsersEntity user = Session["User"] as UsersEntity; // //获取当前这个人的这个小时发言的数量 string uid = string.Empty; if (Session["User"] != null) { UsersEntity user = Session["User"] as UsersEntity; uid = user.Id.ToString(); } else { uid = ShopUtils.GetBSPCookie("bsp"); if (string.IsNullOrEmpty(uid.ToString())) { uid = Guid.NewGuid().ToString(); ShopUtils.SetBSPCookie("bsp", uid); } } SpeechInfoBLL bll = new SpeechInfoBLL(); IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; var ct = addre.Substring(0,IndexofA); var sourceaddr = addre; var citys = bll.GetCitys(); if (citys.FirstOrDefault(s => s.CityName == ct) == null) { ct = "重庆市"; } SpeechInfoBLL bill = new SpeechInfoBLL(); if (!string.IsNullOrEmpty(uid)) { int num = bill.GetSpeechCount(new Guid(uid)); if (num >= 3) { return AjaxResult("err", "发送失败一小时内最多能发3条!", false); } } model.SourceCity = sourceaddr; model.FromUser = new Guid(uid); model.IsVip = Convert.ToByte(Guid.Empty.Equals(new Guid(uid)) ? 0 : 1); model.SumbitTime = DateTime.Now; model.State = 1; //-1为删除状态,1表示正常 model.City = ct; // SpeechInfoBLL bll = new SpeechInfoBLL(); if (bll.Insert(model, null)) { return AjaxResult("ok", "发送成功!", false); } else { return AjaxResult("ok", "发送失败!", false); } //} //return AjaxResult("err", "请登陆后发信息!", false); } catch (Exception ex) { //return AjaxResult("err", "发送失败!" + ex.ToString(), false); throw; } }
public string GetIpLocation(string ip) { return(IPScaner.IPLocation(ip)); }
public string GetIP() { return(IPScaner.IPLocation(Eval("IP", ""))); }
/// <summary> /// 获取在用户数据 /// </summary> /// <param name="only_visitor">是否只取游客</param> /// <returns></returns> public string GetOnlineJson(bool only_visitor) { RemoveExpireUser(); string ignore = GetLogin().UserID; string result = ""; foreach (M_OnlineUser user in OnlineUserList) { if (only_visitor && !user.IsVisitor) { continue; } if (user.UserID == ignore) { continue; } //不返回自身 //if (string.IsNullOrEmpty(user.IP)) { user.IP = IPScaner.GetUserIP(); } result += "{\"UserID\":\"" + user.UserID + "\",\"UserName\":\"" + user.UserName + "\",\"UserFace\":\"" + user.UserFace + "\",\"IP\":\"" + user.IP + "," + IPScaner.IPLocation(user.IP) + "\"},"; } return("[" + result.TrimEnd(',') + "]"); }
/// <summary> /// 说明:初始化调用构造函数后可能不可用的数据。 /// </summary> /// <param name="requestContext"></param> protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); SpeechInfoBLL bll = new SpeechInfoBLL(); citys = bll.GetCitys(); WorkContext.IsHttpAjax = WebHelper.IsAjax(); WorkContext.Url = WebHelper.GetUrl(); WorkContext.UrlReferrer = WebHelper.GetUrlReferrer(); WorkContext.IP = WebHelper.GetIP(); // WebHelper.GetIP(); if (string.IsNullOrWhiteSpace(WorkContext.IP) || WorkContext.IP == "127.0.0.1") { WorkContext.CityName = "重庆市"; } else { //测试地址搜索#region 测试地址搜索 IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; WorkContext.CityName = addre.Substring(IndexofA); } UsersEntity userInfo = new UsersEntity(); Guid uid = ShopUtils.GetUidCookie(); //获得保存在cookie中的密码 string encryptPwd = ShopUtils.GetCookiePassword(); UsersBLL userBll = new UsersBLL(); if (Session["User"] != null) { CurrentUser = Session["User"] as UsersEntity; userInfo = CurrentUser; } else { userInfo = userBll.GetPartUserByUidAndPwd(uid); // requestContext.HttpContext.Response.Write("<script>alert('登录超时!');window.location.reload();</script>"); } if (userInfo != null && !Guid.Empty.Equals(userInfo.Id)) { WorkContext.Uid = userInfo.Id; WorkContext.Password = userInfo.Password; WorkContext.UserEmail = userInfo.Email; WorkContext.NickName = string.IsNullOrWhiteSpace(userInfo.NickName) ? userInfo.Email : userInfo.NickName; } //从cookie中获取用户的基本信息 }
public ActionResult Save(SpeechInfoEntity model) { try { SpeechInfoBLL bll = new SpeechInfoBLL(); IPScaner objScan = new IPScaner(); string ip = Request.UserHostAddress.ToString(); objScan.DataPath = Server.MapPath("/App_data/qqwry.Dat"); objScan.IP = WorkContext.IP; //"113.200.29.90"; string addre = objScan.IPLocation(); int IndexofA = addre.IndexOf("省") + 1; var ct = addre.Substring(0,IndexofA); var sourceaddr = addre; var citys= bll.GetCitys(); if (citys.FirstOrDefault(s => s.CityName == ct) == null) { ct = "重庆市"; } model.SourceCity = sourceaddr; model.City = ct; model.FromUser = WorkContext.Uid; model.IsVip = Convert.ToByte(Guid.Empty.Equals(WorkContext.Uid) ? 0 : 1); model.SumbitTime = DateTime.Now; model.State = 1;//-1为删除状态,1表示正常 if (bll.Insert(model, null)) { return AjaxResult("ok", "发送成功!", false); } else { return AjaxResult("err", "发送失败!", false); } } catch (Exception ex) { return AjaxResult("err", "发送失败!" + ex.ToString(), false); throw; } }