private void CheckIP(M_Survey info) { string ip = IPScaner.GetUserIP(); if (info.IPRepeat < 1) { return; } if (ip.StartsWith("192.168") || ip.Equals("::1")) { return; } List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter("ip", ip), new SqlParameter("sdate", DateTime.Now.ToString("yyyy/MM/dd 00:00:00")), new SqlParameter("edate", DateTime.Now.ToString("yyyy/MM/dd 23:59:59")) }; int count = DBCenter.Count("ZL_Answer_Recode", "SubmitIP=@ip AND Sid=" + info.SurveyID + " AND (SubmitDate>@sdate AND SubmitDate<@edate)", sp); if (count > info.IPRepeat) { function.WriteErrMsg("对不起,系统限定:一个IP一天只能提交" + info.IPRepeat + "份,请明天再来。。"); } }
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 static void Insert(M_UserExpHis model) { if (model.UserID == 0) { M_UserInfo mu = new B_User().GetLogin(); if (mu != null) { model.UserID = mu.UserID; } } if (model.Operator == 0) { M_AdminInfo adminMod = B_Admin.GetLogin(); if (adminMod != null) { model.Operator = adminMod.AdminId; } } if (string.IsNullOrEmpty(model.OperatorIP)) { model.OperatorIP = IPScaner.GetUserIP(); } if (string.IsNullOrEmpty(model.Remark) && HttpContext.Current != null) { model.Remark = HttpContext.Current.Request.RawUrl; } if (model.HisTime <= DateTime.MinValue) { model.HisTime = DateTime.Now; } model.TbName = GetTbName((SType)model.ScoreType); DBCenter.Insert(model); }
public static M_AdminInfo AuthenticateAdmin(string AdminName, string Password) { if (string.IsNullOrEmpty(AdminName) || string.IsNullOrEmpty(Password)) { return(null); } M_AdminInfo adminMod = null; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("AdminName", AdminName), new SqlParameter("AdminPassword", StringHelper.MD5(Password)) }; using (DbDataReader reader = DBCenter.SelReturnReader(tbName, "AdminName=@AdminName AND AdminPassword=@AdminPassword", sp)) { if (reader.Read()) { adminMod = new M_AdminInfo().GetModelFromReader(reader); } else { return(null); } } adminMod.LastLoginIP = IPScaner.GetUserIP(); adminMod.LastLoginTime = DateTime.Now; adminMod.LoginTimes++; Update(adminMod); return(adminMod); }
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 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 IActionResult AddReply() { int GID = DataConverter.CLng(RequestEx["GID"]); if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"])) { return(WriteErr("验证码不正确", Request.RawUrl())); } M_GuestBook pinfo = guestBll.SelReturnModel(GID); M_GuestBookCate cateMod = cateBll.SelReturnModel(pinfo.CateID); M_GuestBook info = new M_GuestBook(); M_UserInfo mu = buser.GetLogin(); info.UserID = mu.UserID; info.ParentID = GID; info.Status = cateMod.Status == 1 ? 0 : 1; info.Title = "[会员回复]"; info.CateID = pinfo.CateID; info.TContent = Request.Form["Content"]; //info.Status = SiteConfig.SiteOption.OpenAudit > 0 ? 0 : 1; info.IP = IPScaner.GetUserIP(HttpContext); guestBll.AddTips(info); if (info.Status == 1) { return(WriteOK("回复成功", "GuestShow?Gid=" + GID)); } else { return(WriteOK("您的回复已提交,请等待后系统审核", "GuestShow?Gid=" + GID)); } }
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 int Insert(M_Common_UserApply model) { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } return(DBCenter.Insert(model)); }
public int Insert(M_Design_Pub model) { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } return(DBCenter.Insert(model)); }
protected void btnSubmit_Click(object sender, EventArgs e) { M_Survey info = surBll.GetSurveyBySid(Sid); if (info.IsNull) { function.WriteErrMsg("该问卷不存在!可能已被删除"); } DateTime SubmitDate = DateTime.Now; string SIP = IPScaner.GetUserIP(); //----如该问卷是不用登录的,则以随机码作为用户名 int UserID = GetUserID(info); if (info.IsCheck && !CheckVCode(SendVcode.Text.Trim())) { function.Script(this, "alert('验证码不正确');"); return; } IList <M_Question> list = B_Survey.GetQueList(Sid); for (int i = 0; i < list.Count; i++) { M_Answer ans = new M_Answer(); string re = Request.Form["vote_" + i]; string[] OptionValue = list[i].QuestionContent.Split(new char[] { '|' }); if (list[i].TypeID == 2) { string[] ReArr = re.Split(new char[] { ',' }); for (int s = 0; s < ReArr.Length; s++) { ans.AnswerID = 0; ans.AnswerContent = ReArr[s]; ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } } else { ans.AnswerID = 0; ans.AnswerContent = re; ans.QuestionID = list[i].QuestionID; ans.SurveyID = Sid; ans.SubmitIP = SIP; ans.SubmitDate = SubmitDate; ans.UserID = UserID; B_Survey.AddAnswer(ans); } } B_Survey.AddAnswerRecord(Sid, UserID, SIP, SubmitDate, 1); string url = "VoteResult.aspx?SID=" + Sid; function.WriteSuccessMsg("提交成功!感谢您的参与!", Page.ResolveClientUrl(url)); }
public string Comment_API() { string action = RequestEx["action"]; string value = ""; string result = ""; switch (action) { case "report": //举报 value = Request.Form["cid"]; cmtBll.ReportComment(Convert.ToInt32(value), mu.UserID); result = Success.ToString(); break; case "support": //支持反对操作 value = Request.Form["flag"]; bool rflag = true; bool flag = DataConverter.CLng(value) > 0; if (buser.GetLogin().IsNull) { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, IPScaner.GetUserIP(HttpContext)); } else { rflag = cmtBll.Support(Convert.ToInt32(Request.Form["id"]), flag ? 1 : 0, IPScaner.GetUserIP(HttpContext), mu.UserID, mu.UserName); } result = rflag ? Success.ToString() : Failed.ToString(); break; case "assist": //顶与踩 bool bl = true; if (buser.GetLogin().IsNull) { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), IPScaner.GetUserIP(HttpContext), Convert.ToInt32(Request.Form["gid"])); } else { bl = cmtBll.Support(0, Convert.ToInt32(Request.Form["value"]), IPScaner.GetUserIP(HttpContext), mu.UserID, mu.UserName, Convert.ToInt32(Request.Form["gid"])); } result = bl ? "1" : "0"; break; case "reply": //回复 result = Comment_Reply(); break; case "sender": //发送评论 result = SendComm(); break; default: throw new Exception(action + "不存在"); } return(result); }
//------------- //检测问卷可否被提交 private bool CheckAsk(M_Design_Ask askMod, ref string err) { string ip = IPScaner.GetUserIP(HttpContext); if (askMod == null) { err = "问卷不存在"; return(false); } if (askMod.IsNeedLogin == 1 && mu.IsNull) { err = "[" + askMod.Title + "]必须登录后才可访问"; return(false); } if (askMod.ZStatus != (int)ZLEnum.ConStatus.Audited) { err = "[" + askMod.Title + "]未开放"; return(false); } if (askMod.StartDate >= DateTime.Now) { err = "[" + askMod.Title + "]尚未到开放时间"; return(false); } if (askMod.EndDate <= DateTime.Now) { err = "[" + askMod.Title + "]已经结束"; return(false); } if (askMod.IsIPLimit > 0) { //if (ip.StartsWith("192.168") || ip.Equals("::1")) { } List <SqlParameter> sp = new List <SqlParameter>() { new SqlParameter("ip", ip), new SqlParameter("sdate", DateTime.Now.ToString("yyyy/MM/dd 00:00:00")), new SqlParameter("edate", DateTime.Now.ToString("yyyy/MM/dd 23:59:59")) }; int count = DBCenter.Count(ansBll.TbName, "IP=@ip AND AskID=" + askMod.ID + " AND (CDate>@sdate AND CDate<@edate)", sp); if (count >= askMod.IsIPLimit) { err = "系统限定:一天只能提交" + askMod.IsIPLimit + "份,请明天再来"; return(false); } } if (askMod.IPInterval > 0) { //取最近的一条记录 M_Design_Answer ansMod = ansBll.SelModelByIP(ip); if (ansMod == null || (DateTime.Now - ansMod.CDate).TotalSeconds > askMod.IPInterval) { } else { err = "系统限定:每隔" + DateHelper.ShowSeconds(askMod.IPInterval) + "才可再次提交"; return(false); } } return(true); }
//申请加入 protected void Apply_B_Click(object sender, EventArgs e) { int compid = DataConverter.CLng(compId_Hid.Value); M_UserInfo mu = buser.GetLogin(); //记录用户信息并写入 ualyMod.UserID = mu.UserID; ualyMod.ZType = "plat_joincomp"; ualyMod.UserName = mu.UserName + "(" + mu.TrueName + ")"; ualyMod.Remind = compid.ToString(); ualyMod.IP = IPScaner.GetUserIP(); ualyBll.Insert(ualyMod); function.WriteSuccessMsg("申请成功,请等待管理员审核"); }
public IActionResult Add() { if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"])) { return(WriteErr("验证码不正确", Request.RawUrl())); } int CateID = DataConverter.CLng(RequestEx["Cate"]); M_GuestBook info = new M_GuestBook(); M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID); //不允许匿名登录,必须登录才能发表留言 if (cateMod.NeedLog == 1) { if (!mu.IsNull) { info.UserID = mu.UserID; } else { return(Redirect("/User/Login")); } } else if (buser.CheckLogin()) { info.UserID = buser.GetLogin().UserID; } info.CateID = CateID; //是否开启审核 info.Status = cateMod.Status == 1 ? 0 : 1; info.ParentID = 0; info.Title = HttpUtility.HtmlEncode(Request.Form["Title"]); info.TContent = RequestEx["Content"]; info.IP = IPScaner.GetUserIP(HttpContext); guestBll.AddTips(info); if (cateMod.Status == 1) { if (cateMod.IsShowUnaudit == 1) { return(WriteOK("您的留言已提交,请等待系统审核", "/Guest/Default?CateID=" + CateID)); } else { return(WriteOK("您的留言已提交,通过系统审核后会出现在开放列表中", "/Guest/Default?CateID=" + CateID)); } } else { return(WriteOK("留言成功", "/Guest/Default?CateID=" + CateID)); } }
//申请加入公司(一张表用于存其)//ZL_Plat_JoinCompApply protected void AddComp_Btn_Click(object sender, EventArgs e) { M_User_Plat upMod = B_User_Plat.GetLogin(); //记录用户信息并写入 M_Common_UserApply ualyMod = new M_Common_UserApply(); B_Common_UserApply ualyBll = new B_Common_UserApply(); ualyMod.UserID = upMod.UserID; ualyMod.ZType = "plat_joincomp"; ualyMod.UserName = upMod.UserName + "(" + upMod.TrueName + ")"; ualyMod.Remind = CompID.ToString(); ualyMod.IP = IPScaner.GetUserIP(); ualyBll.Insert(ualyMod); function.WriteSuccessMsg("申请成功,请等待管理员审核", "/Plat/"); }
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); }
protected void Page_Load(object sender, EventArgs e) { if (SiteConfig.SiteOption.RegManager != 1) { function.WriteErrMsg("未开启管理员申请功能"); } if (!IsPostBack) { IPCity cityMod = IPScaner.FindCity(IPScaner.GetUserIP()); if (cityMod.IsValid) { function.Script(this, "pcc.SetDef('" + cityMod.Province + "','" + cityMod.City + "','" + cityMod.County + "');"); } function.Script(this, "pcc.ProvinceInit();"); } }
public string ResultAdd_Submit() { if (!AdminCheck()) { return("无权访问"); } int ansnum = DataConvert.CLng(GetParam("ansnum")); if (ansnum < 1) { return("投票人数不正确"); } //[后期改为附加虚拟值的方式] M_Design_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return("问卷不存在"); } //-------------------------------- M_Design_Answer ansMod = new M_Design_Answer(); ansMod.AskID = askMod.ID; //ansMod.Answer = Req("answer");//{qid:1,answer:'is answer'} ansMod.Answer = GetParam("answer"); ansMod.UserID = -1; ansMod.IP = IPScaner.GetUserIP(HttpContext); ansMod.Source = "管理员添加"; for (int i = 0; i < ansnum; i++) { ansMod.ID = 0; ansMod.ID = ansBll.Insert(ansMod); //-----------单独写入表中,便于后期分析(后期优化为批量插入) List <M_SubOption> ansList = JsonConvert.DeserializeObject <List <M_SubOption> >(GetParam("answer")); foreach (M_SubOption ans in ansList) { M_Design_AnsDetail ansdeMod = new M_Design_AnsDetail(); ansdeMod.AskID = ansMod.AskID; ansdeMod.AnsID = ansMod.ID; ansdeMod.Qid = ans.qid; ansdeMod.Answer = ans.answer; ansdeMod.UserID = ansMod.UserID; ansdeBll.Insert(ansdeMod); } } return(Success.ToString()); }
public VM_Register() { //根据IP,分析出地址,并填充 cityMod = IPScaner.FindCity(IPScaner.GetUserIP());//"59.52.159.79" // //html_must = fieldBll.InputallHtml(0, 0, new ModelConfig() //{ // Source = ModelConfig.SType.UserRegister, // Fields = SiteConfig.UserConfig.RegFieldsMustFill //}); //html_select = fieldBll.InputallHtml(0, 0, new ModelConfig() //{ // Source = ModelConfig.SType.UserRegister, // Fields = SiteConfig.UserConfig.RegFieldsSelectFill //}); //1,添加字段2,用户参数--将其加入必填或选填字段3,输出给前端使用 string selectFields = SiteConfig.UserConfig.RegFieldsSelectFill, mustFields = SiteConfig.UserConfig.RegFieldsMustFill; if (!string.IsNullOrEmpty(selectFields) || !string.IsNullOrEmpty(mustFields)) { fieldDT = SqlHelper.ExecuteTable("SELECT *,ModelID=0,IsShow='True',IsSearchForm='False',IsView=1,IsDownField=0 FROM ZL_UserBaseField"); if (!string.IsNullOrEmpty(selectFields)) { fieldDT.DefaultView.RowFilter = "FieldName IN (" + WrapFields(selectFields) + ")"; selectDT = fieldDT.DefaultView.ToTable(); } if (!string.IsNullOrEmpty(mustFields)) { fieldDT.DefaultView.RowFilter = "FieldName IN (" + WrapFields(mustFields) + ")"; mustDT = fieldDT.DefaultView.ToTable(); } } //---------------------------------------------- groupDT = gpBll.GetSelGroup(); int puid = DataConvert.CLng(Request.QueryString["ParentUserID"]); string puname = DataConvert.CStr(Request.QueryString["ParentUser"]); if (puid > 0) { pmu = buser.SelReturnModel(puid); } else if (!string.IsNullOrEmpty(puname)) { pmu = buser.GetUserIDByUserName(puname); } }
private static M_Log EmptyDeal(Model.ZLEnum.Log type, M_Log model) { if (string.IsNullOrEmpty(model.Action)) { model.Action = type.ToString(); } if (model.CDate <= DateTime.MinValue) { model.CDate = DateTime.Now; } try { if (string.IsNullOrEmpty(model.IP)) { model.IP = IPScaner.GetUserIP(); } if (string.IsNullOrEmpty(model.Source)) { model.Source = HttpContext.Current.Request.RawUrl; } } catch { } if (type == Model.ZLEnum.Log.fileup || type == Model.ZLEnum.Log.safe) { try { if (string.IsNullOrEmpty(model.UName)) { M_UserInfo mu = new B_User().GetLogin(); if (mu != null && mu.UserID != 0) { model.UName = mu.UserName; } } if (string.IsNullOrEmpty(model.AName)) { M_AdminInfo adminMod = B_Admin.GetLogin(); if (adminMod != null && adminMod.AdminId > 0) { model.AName = adminMod.AdminName; } } } catch { } } return(model); }
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) }); } } }
public string Vote_Submit() { M_Design_Ask askMod = askBll.SelReturnModel(Mid); if (askMod == null) { return("问卷不存在"); } if (askMod.IsEnableVCode == 1) { if (!ZoomlaSecurityCenter.VCodeCheck(GetParam("vkey"), GetParam("vcode"))) { return("验证码不正确"); } } if (!CheckAsk(askMod, ref err)) { return(err); } M_Design_Answer ansMod = new M_Design_Answer(); ansMod.AskID = askMod.ID; //ansMod.Answer = Req("answer");//{qid:1,answer:'is answer'} ansMod.Answer = GetParam("answer"); ansMod.UserID = mu.UserID; ansMod.IP = IPScaner.GetUserIP(HttpContext); //ansMod.Source = DeviceHelper.GetBrower().ToString(); ansMod.ID = ansBll.Insert(ansMod); //-----------单独写入表中,便于后期分析(后期优化为批量插入) List <M_SubOption> ansList = JsonConvert.DeserializeObject <List <M_SubOption> >(GetParam("answer")); foreach (M_SubOption ans in ansList) { M_Design_AnsDetail ansdeMod = new M_Design_AnsDetail(); ansdeMod.AskID = ansMod.AskID; ansdeMod.AnsID = ansMod.ID; ansdeMod.Qid = ans.qid; ansdeMod.Answer = ans.answer; ansdeMod.UserID = ansMod.UserID; ansdeBll.Insert(ansdeMod); } return(Success.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //BindDP(); M_UserInfo mu = buser.GetLogin(); if (Mid > 0) { M_UserRecei model = receBll.GetSelect(Mid, mu.UserID); if (model == null) { function.WriteErrMsg("修改的地址不存在"); } ZipCode_T.Text = model.Zipcode; //省市县 Street_T.Text = model.Street; ReceName_T.Text = model.ReceivName; MobileNum_T.Text = model.MobileNum; pro_hid.Value = model.Provinces; Def_chk.Checked = model.isDefault == 1 ? true : false; if (model.phone.Split('-').Length > 1) { Area_T.Text = model.phone.Split('-')[0]; Phone_T.Text = model.phone.Split('-')[1]; } rUrl = Request.QueryString["ReturnUrl"]; } else { IPCity cityMod = IPScaner.FindCity(IPScaner.GetUserIP());//"59.52.159.79" if (cityMod.IsValid) { function.Script(this, "pcc.SetDef('" + cityMod.Province + "','" + cityMod.City + "','" + cityMod.County + "');"); } } //用户没有其它地址时自动开启默认 DataTable addressDT = receBll.SelByUID(mu.UserID); if (addressDT == null || addressDT.Rows.Count < 1) { Def_chk.Checked = true; } } }
//批量插入(需优化代码) public void Insert(List <M_UAction> list) { string ip = IPScaner.GetUserIP(); int uid = 0; string uname = ""; DateTime cdate = DateTime.Now; M_UserInfo mu = new B_User().GetLogin(); if (mu != null && mu.UserID > 0) { uid = mu.UserID; uname = mu.UserName; } for (int i = 0; i < list.Count; i++)//后期更换为批量插入 { list[i].uid = uid; list[i].ip = ip; list[i].uname = uname; list[i].cdate = DateTime.Now; Insert(list[i]); } }
private void ForDataColumn(M_Pub pubMod, DataTable dt) { M_UserInfo mu = buser.GetLogin(); string[] fields = "PubAddTime,PubUserName,PubUserID,PubIP,Pubupid,Pubstart".Split(','); foreach (string field in fields) { if (!dt.Columns.Contains(field)) { dt.Columns.Add(new DataColumn(field, typeof(string))); } } DataRow dr = dt.Rows[0]; dr["PubAddTime"] = DateTime.Now; dr["PubUserName"] = mu.UserName; dr["PubUserID"] = mu.UserID; dr["PubIP"] = IPScaner.GetUserIP(); dr["Pubupid"] = PubID; dr["Pubstart"] = pubMod.PubIsTrue == 1 ? 0 : 1;//是否审核 }
protected void EBtnSubmit_Click(object sender, EventArgs e) { B_User buser = new B_User(); M_GuestBook info = new M_GuestBook(); if (Mid > 0) { info = guestBll.GetQuest(Mid); } info.ParentID = Convert.ToInt16(Request.QueryString["GID"]); info.CateID = Convert.ToInt16(Request.QueryString["CateId"]); info.UserID = buser.GetLogin().UserID; info.Title = this.TextBox1.Text.Trim() == "" ? "<font style='color:#1e860b;'>[管理员回复]</font>" : BaseClass.CheckInjection(this.TextBox1.Text.Trim()); info.TContent = BaseClass.CheckInjection(this.tx_Content.Value); info.Status = 1; info.IP = IPScaner.GetUserIP(); if (guestBll.AddTips(info)) { Response.Redirect("GuestBookShow.aspx?GID=" + Request.QueryString["GID"] + "&CateID=" + Request.QueryString["CateID"]); } }
/// <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)); }
public ActionResult Apply_Add() { B_Store_Info stBll = new B_Store_Info(); int modelid = DataConvert.CLng(Request.Form["model_dp"]); string store = Request.Form["store_t"]; M_CommonData CData = conBll.SelMyStore(mu.UserName); if (CData == null) { CData = new M_CommonData(); } //---------------------------------------- if (string.IsNullOrEmpty(store)) { function.WriteErrMsg("店铺名称不能为空"); return(Content("")); } //M_StoreStyleTable sst = sstbll.GetNewStyle(modelid); //if (sst.ID == 0) { function.WriteErrMsg("后台没有为该模型绑定可用的模板!"); return Content(""); } CData.Title = HttpUtility.HtmlEncode(Request.Form["store_t"]); CData.DefaultSkins = DataConverter.CLng(Request.Form["TempleID_Hid"]); CData.ModelID = modelid; CData.TableName = modBll.SelReturnModel(CData.ModelID).TableName; CData.Inputer = mu.UserName; CData.SuccessfulUserID = mu.UserID; CData.Inputer = mu.UserName; CData.IP = IPScaner.GetUserIP(); DataTable dt = fieldBll.GetModelFieldList(modelid); DataTable table = new Call().GetDTFromMVC(dt, Request); table = stBll.FillDT(CData, table); if (CData.GeneralID > 0) { conBll.UpdateContent(table, CData); } else { conBll.AddContent(table, CData); } return(View("StoreAuditing")); }
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; } }
/// <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; } }