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)); } }
public void Add() { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"])) { function.WriteErrMsg("验证码不正确", Request.RawUrl); return; } int CateID = DataConverter.CLng(Request["Cate"]); M_GuestBook info = new M_GuestBook(); M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID); //不允许匿名登录,必须登录才能发表留言 if (cateMod.NeedLog == 1) { if (buser.CheckLogin()) { info.UserID = DataConverter.CLng(buser.GetLogin().UserID); } else { B_User.CheckIsLogged(Request.RawUrl); return; } } else if (buser.CheckLogin()) { info.UserID = buser.GetLogin().UserID; } info.CateID = CateID; //是否开启审核 info.Status = cateMod.Status == 1 ? 0 : 1; info.ParentID = 0; info.Title = Server.HtmlEncode(Request.Form["Title"]); info.TContent = Request.Form["Content"]; info.IP = EnviorHelper.GetUserIP(); guestBll.AddTips(info); if (cateMod.Status == 1) { if (cateMod.IsShowUnaudit == 1) { function.WriteSuccessMsg("您的留言已提交,请等待系统审核", "/Guest/Default?CateID=" + CateID); return; } else { function.WriteSuccessMsg("您的留言已提交,通过系统审核后会出现在开放列表中", "/Guest/Default?CateID=" + CateID); return; } } else { function.WriteSuccessMsg("留言成功", "/Guest/Default?CateID=" + CateID); return; } }
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"]); } }