Example #1
0
        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 Comment_Reply()
        {
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                return("-1");
            }
            M_CommonData cdata   = conBll.GetCommonData(ItemID);
            M_Node       mnode   = nodeBll.GetNodeXML(cdata.NodeID);
            M_Comment    comment = new M_Comment();

            comment.GeneralID = ItemID;
            comment.UserID    = mu.UserID;
            comment.Audited   = true;
            comment.Pid       = DataConverter.CLng(Request.Form["id"]);
            comment.Contents  = Request.Form["content"];
            if (mnode.CommentType.Equals("2") && mu.IsNull)
            {
                return("-2");
            }
            else if (string.IsNullOrEmpty(comment.Contents))
            {
                return("-3");
            }
            else
            {
                AddComment(comment); return("1");
            }
        }
Example #3
0
    protected void PostMsg_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo mu = tpuserBll.GetLogin();//barBll.GetUser();

        if (mu.Status != 0)
        {
            function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!");
        }
        M_Guest_Bar     lastMod   = barBll.SelLastModByUid(mu, false);
        M_GuestBookCate catemod   = bookBll.GetCate(Cid);
        BarOption       baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == Cid);
        int             usertime  = baroption == null ? 120 : baroption.UserTime;
        int             sendtime  = baroption == null ? 5 : baroption.SendTime;

        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text.Trim()))
        {
            function.WriteErrMsg("验证码不正确", "/" + CreateUrl(2, Pid, CPage));
        }
        else if (catemod.IsBarOwner(mu.UserID))
        {
        }
        else if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限
        {
            int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes;
            function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);");
        }
        else if (lastMod != null && ((int)(DateTime.Now - lastMod.CDate).TotalMinutes) < sendtime)
        {
            int second = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes;
            function.WriteErrMsg("你回复太快了," + second + "分钟后才能再次回复", "javascript:history.go(-1);");
        }
        barMod = FillMsg(MsgContent_T.Text, Pid);
        barBll.Insert(barMod);
        Response.Redirect(CreateUrl(2, Pid, CPage));
    }
Example #4
0
        public ActionResult GetPassWord_Mobile()
        {
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                function.WriteErrMsg("验证码不正确", "/User/Change/GetPassword"); return(Content(""));
            }
            M_UserInfo mu     = GetUserByName(Request.Form["TxtUserName"]);
            M_Uinfo    basemu = buser.GetUserBaseByuserid(mu.UserID);

            if (string.IsNullOrEmpty(basemu.Mobile))
            {
                function.WriteErrMsg("用户未设置手机号,无法通过手机号找回"); return(Content(""));
            }
            string code    = function.GetRandomString(6, 2);
            string content = "【" + SiteConfig.SiteInfo.SiteName + "】,你正在使用找回密码服务,校验码:" + code;

            SendWebSMS.SendMessage(basemu.Mobile, content);
            //短信信息存入数据库
            M_Message messInfo = new M_Message();

            messInfo.Title    = "验证码:找回密码";
            messInfo.PostDate = DataConverter.CDate(DateTime.Now.ToLocalTime().ToString());
            messInfo.Content  = content;
            messInfo.Receipt  = "";
            messInfo.MsgType  = 3;
            messInfo.status   = 1;
            messInfo.Incept   = mu.UserID.ToString();
            B_Message.Add(messInfo);

            mu.seturl = code;
            buser.UpdateByID(mu);
            GetPwdStep = "mobile_code";
            return(View("GetPassWord"));
        }
Example #5
0
        public void GetPassWord_Email()
        {
            B_MailManage mailBll = new B_MailManage();

            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                function.WriteErrMsg("验证码不正确", "/User/GetPassword"); return;
            }
            M_UserInfo mu = GetUserByName(Request.Form["TxtUserName"]);

            if (string.IsNullOrEmpty(mu.Email) || mu.Email.Contains("@random"))
            {
                function.WriteErrMsg("用户未设置邮箱,无法通过邮箱找回"); return;
            }
            //生成Email验证链接
            string seturl = function.GetRandomString(12) + "," + DateTime.Now.ToString();

            mu.seturl = seturl;
            buser.UpDateUser(mu);
            //Email发送
            string url       = SiteConfig.SiteInfo.SiteUrl + "/User/GetPassWord?key=" + mu.seturl + "&uid=" + mu.UserID;
            string returnurl = "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>";
            string content   = mailBll.SelByType(B_MailManage.MailType.RetrievePWD);

            content = new OrderCommon().TlpDeal(content, GetPwdEmailDt(mu.UserName, SiteConfig.SiteInfo.SiteName, returnurl));
            MailInfo mailInfo = SendMail.GetMailInfo(mu.Email, SiteConfig.SiteInfo.SiteName, SiteConfig.SiteInfo.SiteName + "_找回密码", content);

            SendMail.Send(mailInfo);
            //不需要更新步骤,其从邮箱进入地址栏后再更新
            function.WriteSuccessMsg("密码重设请求提交成功,<a href='" + B_Plat_Common.GetMailSite(mu.Email) + "' target='_blank'>请前往邮箱查收</a>!!", "", 0); return;
        }
        //自有账号登录(跳转页面)
        public string Login_Ajax(string uname, string upwd, string vcode, int regid)
        {
            string      err    = "";
            M_APIResult retMod = new M_APIResult(M_APIResult.Failed);

            if (SiteConfig.UserConfig.EnableCheckCodeOfLogin || UserLoginCount >= 3)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], vcode.Trim()))
                {
                    retMod.retmsg = "验证码不正确";
                    return(retMod.ToString());
                }
            }
            M_UserInfo mu = LoginByRegID(ref err, uname, upwd, regid);

            if (mu.IsNull)
            {
                UserLoginCount++; retMod.retmsg = err; if (UserLoginCount >= 3)
                {
                    retMod.addon = "showvcode";
                }
            }
            else if (mu.Status != 0)
            {
                retMod.retmsg = "你的帐户未通过验证或被锁定,请与网站管理员联系";
            }
            else
            {
                UserLoginCount = 0;
                retMod.retcode = M_APIResult.Success;
                buser.SetLoginState(mu, "Month");
            }
            return(retMod.ToString());
        }
Example #7
0
    protected void PostMsg_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo mu = tpuser_Bll.GetLogin();//barBll.GetUser();

        if (mu.Status != 0)
        {
            function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!");
        }
        M_Guest_Bar     lastMod   = barBll.SelLastModByUid(mu);
        M_GuestBookCate catemod   = guestBll.GetCate(CateID);
        BarOption       baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID);
        int             usertime  = baroption == null ? 120 : baroption.UserTime;
        int             sendtime  = baroption == null?5:baroption.SendTime;

        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text.Trim()))
        {
            function.WriteErrMsg("验证码不正确", "/" + B_Guest_Bar.CreateUrl(1, CateID, CPage));
        }
        else if (catemod.IsBarOwner(mu.UserID))
        {
        }
        else if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限
        {
            int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes;
            function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);");
        }
        else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime)
        {
            int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes;
            function.WriteErrMsg("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);");
        }
        string msg = MsgContent_T.Text;

        GetSubTitle(ref msg);
        catemod = guestBll.SelReturnModel(CateID);
        barMod  = FillMsg(MsgTitle_T.Text, msg, catemod);
        int id = barBll.Insert(barMod);

        if (catemod.Status == 1 && mu.UserID > 0) //是否需审核
        {
            if (catemod.IsPlat == 1)              //分享到能力中心
            {
                string siteurl = "http://" + Request.Url.Authority + "/";
                string url     = B_Guest_Bar.CreateUrl(2, id);
                string cateurl = B_Guest_Bar.CreateUrl(1, catemod.CateID);
                msgBll.InsertMsg(string.Format(forwardTlp, barMod.Title, siteurl + url, siteurl + url, catemod.CateName, siteurl + cateurl));
            }
            buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
            {
                score     = catemod.SendScore,
                ScoreType = (int)M_UserExpHis.SType.Point,
                detail    = string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, catemod.CateName, MsgTitle_T.Text.Trim(), catemod.SendScore)
            });
            Response.Redirect("/" + B_Guest_Bar.CreateUrl(2, id));
        }
        else
        {
            Response.Redirect("/" + B_Guest_Bar.CreateUrl(1, CateID));
        }
    }
        // 发表评论
        private string SendComm()
        {
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                return("-1");
            }
            //内容为空不允许发送
            if (string.IsNullOrEmpty(Request.Form["content"]))
            {
                return("-3");
            }
            M_UserInfo   mu      = buser.GetLogin(false);
            M_Comment    comment = new M_Comment();
            M_CommonData cdata   = conBll.GetCommonData(ItemID);

            comment.GeneralID = ItemID;
            //是否开放评论
            if (cdata.IsComm == 0)
            {
                return("-4");
            }
            //节点是否开启评论权限
            M_Node nodeMod = nodeBll.SelReturnModel(cdata.NodeID);

            //需要登录,但用户未登录
            if (nodeMod.CommentType.Equals("2") && !buser.CheckLogin())
            {
                return("-2");
            }
            comment.UserID   = mu.UserID;//支持一个支持匿名方法
            comment.Contents = BaseClass.CheckInjection(Request.Form["content"]);
            comment.Audited  = true;
            //DataTable dts = cmtBll.SeachComment_ByGeneralID2(ItemID);
            //if (nodeMod.Purview != null && nodeMod.Purview != "")
            //{
            //    string Purview = nodeMod.Purview;
            //    DataTable AuitDT = nodeBll.GetNodeAuitDT(nodeMod.Purview);
            //    if (AuitDT == null && AuitDT.Rows.Count <= 0) { return "-4"; }
            //    DataRow auitdr = AuitDT.Rows[0];
            //    string forum_v = auitdr["forum"].ToString();
            //    if (string.IsNullOrEmpty(forum_v)) { return "-4"; }
            //    string[] forumarr = forum_v.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            //    //不允许评论
            //    if (!forumarr.Contains("1")) { return "-4"; }
            //    //不需要审核
            //    if (!forumarr.Contains("2")) { comment.Audited = true; }
            //    if (forumarr.Contains("3")) //一个文章只评论一次
            //    {
            //        if (cmtBll.SearchByUser(mu.UserID, cdata.NodeID).Rows.Count > 0) { return "-5"; }
            //    }
            //}
            AddComment(comment);
            return(comment.Audited ? "2" : "1");
        }
Example #9
0
        /// <summary>
        /// 用户ajax登录验证
        /// </summary>
        /// <param name="user"></param>
        /// <param name="pwd"></param>
        /// <param name="vcode">vcode:验证码</param>
        /// <param name="zncode">zncode:动态口令</param>
        /// <param name="txtadmincode">txtadmincode:管理码</param>
        /// <returns></returns>
        public string AjaxVaild(string user, string pwd, string vcode, string zncode = "", string txtadmincode = "")
        {
            user = user.Trim(); pwd = pwd.Trim();
            if (getVcount >= 3)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], vcode))
                {
                    return("验证码不正确");
                }
            }
            if (SiteConfig.SiteOption.EnableSiteManageCode && (txtadmincode.Trim() != SiteConfig.SiteOption.SiteManageCode))
            {
                getVcount = getVcount + 1;
                if (getVcount == 3)
                {
                    return("True");               //刷出验证码
                }
                return("管理码不正确");
            }
            M_AdminInfo info = B_Admin.AuthenticateAdmin(user, pwd);

            if (info == null || info.AdminId < 1)
            {
                getVcount = getVcount + 1;
                if (getVcount == 3)
                {
                    return("True");
                }
                else
                {
                    return("用户名或密码错误!");
                }
            }
            else
            {
                if (info.IsLock)
                {
                    return("你的帐户被锁定,请与超级管理员联系");
                }
                if (!string.IsNullOrEmpty(SiteConfig.SiteOption.AdminKey))
                {
                    byte[]            keys = Base32String.Instance.Decode(SiteConfig.SiteOption.AdminKey);
                    PasscodeGenerator pass = new PasscodeGenerator(new HMACSHA1(keys));
                    if (!pass.VerifyTimeoutCode(zncode))
                    {
                        return("动态口令不对!");
                    }
                }
                getVcount = 0;//清空
            }
            return("True");
        }
Example #10
0
        //发送手机验证码(步骤1或步骤2的)
        public string SendValidCode(string key, string vcode, string mobile)
        {
            if (!B_User.CheckIsLogged(Request.RawUrl))
            {
                return(null);
            }
            B_Safe_Mobile mbBll = new B_Safe_Mobile();

            basemu   = buser.GetUserBaseByuserid(buser.GetLogin().UserID);
            CheckNum = ""; NewCheckNum = "";
            switch (Step)
            {
            case 2:
                NewCheckNum   = function.GetRandomString(6, 2).ToLower();
                basemu.Mobile = mobile;
                break;

            default:
                CheckNum = function.GetRandomString(6, 2).ToLower();
                break;
            }
            if (!ZoomlaSecurityCenter.VCodeCheck(key, vcode))
            {
                retMod.retmsg = "验证码不正确";
            }
            else
            {
                if (mbBll.CheckMobile(basemu.Mobile))
                {
                    string content = "【" + SiteConfig.SiteInfo.SiteName + "】你正在使用修改手机号服务,校验码:" + CheckNum + NewCheckNum;
                    SendWebSMS.SendMessage(basemu.Mobile, content);
                    M_Message messInfo = new M_Message();
                    messInfo.Sender  = basemu.UserId.ToString();
                    messInfo.Title   = "验证码:修改手机号[" + basemu.Mobile + "]";
                    messInfo.Content = content;
                    messInfo.Receipt = "";
                    messInfo.MsgType = 2;
                    messInfo.status  = 1;
                    messInfo.Incept  = basemu.UserId.ToString();
                    B_Message.Add(messInfo);
                    retMod.retcode = M_APIResult.Success;
                    retMod.retmsg  = "校验码已成功发送到你的手机";
                }
                else
                {
                    retMod.retmsg = "禁止向该号码发送短信,请联系管理员";
                }
            }
            return(retMod.ToString());
        }
        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;
            }
        }
Example #12
0
        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));
            }
        }
Example #13
0
    //发送校验号
    protected void SendEMail_Btn_Click(object sender, EventArgs e)
    {
        M_Uinfo basemu = buser.GetUserBaseByuserid(buser.GetLogin().UserID);

        CheckNum = function.GetRandomString(6, 2).ToLower();
        //CheckNum = "111111";
        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text))
        {
            ShowAlert("验证码不正确"); return;
        }
        else
        {
            SendWebSMS.SendMessage(basemu.Mobile, "【" + SiteConfig.SiteInfo.SiteName + "】你正在使用修改手机号服务,校验码:" + CheckNum);
            ShowInfo("校验码已成功发送到你的手机");
        }
    }
Example #14
0
        //回复
        private string btnHuiFu()
        {
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                return("-1");
            }
            M_UserInfo mu      = buser.GetLogin();
            M_Comment  comment = new M_Comment();

            comment.CommentID = 0;
            comment.GeneralID = ItemID;
            M_CommonData cdata = bll.GetCommonData(ItemID);
            M_Node       mnode = nodeBll.GetNodeXML(cdata.NodeID);

            if (mnode.CommentType.Equals("2") && !buser.CheckLogin())
            {
                return("-2");
            }
            //GetNodePreate(cdata.NodeID);
            comment.UserID = mu.UserID;
            comment.Title  = BaseClass.CheckInjection(this.HdnTitle.Value);
            if (string.IsNullOrEmpty(Request.Form["content"]))
            {
                return("-3");
            }
            comment.Contents    = BaseClass.CheckInjection(sll.ProcessSen(Request.Form["content"].ToString()));
            comment.Audited     = false;
            comment.CommentTime = DateTime.Now;
            comment.Status      = 0;
            comment.Pid         = DataConverter.CLng(Request.Form["id"]);
            if (bcomment.Add(comment))
            {
                if (SiteConfig.UserConfig.CommentRule > 0 && mu.UserID > 0)
                {
                    buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
                    {
                        score     = SiteConfig.UserConfig.CommentRule,
                        detail    = "发表评论增加积分",
                        ScoreType = (int)M_UserExpHis.SType.Point
                    });
                }
            }
            return("1");
            //Response.Redirect(Request.RawUrl);
        }
Example #15
0
    //-----------------Step2
    protected void SendNewEmail_Btn_Click(object sender, EventArgs e)
    {
        M_Uinfo basemu = buser.GetUserBaseByuserid(buser.GetLogin().UserID);

        NewMobile = NewMobile_T.Text.Trim();
        //if (buser.IsExist("ume", NewMobile)) { ShowAlert("该手机号已存在"); return; }
        NewCheckNum = function.GetRandomString(6, 2).ToLower();
        //NewCheckNum = "111111";
        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["NewVCode_hid"], NewVCode.Text))
        {
            ShowAlert("验证码不正确" + Request.Form["NewVCode_hid"] + ":" + NewVCode.Text); return;
        }
        else
        {
            SendWebSMS.SendMessage(NewMobile_T.Text, "【" + SiteConfig.SiteInfo.SiteName + "】校验码:" + NewCheckNum);
            ShowInfo("校验码已成功发送到你的新手机!");
        }
    }
Example #16
0
        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 Login_Btn_Click(object sender, EventArgs e)
        {
            if (LoginCount >= 3)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(VCode_hid.Value, VCode.Text))
                {
                    function.WriteErrMsg("验证码不正确!");
                }
            }
            M_AdminInfo admininfo = B_Admin.AuthenticateAdmin(UserName_T.Text, UserPwd_T.Text);

            if (admininfo == null || admininfo.AdminId < 1)
            {
                LoginCount++;
                function.WriteErrMsg("用户名或密码错误!");
            }
            badmin.SetLoginState(admininfo);
            LoginCount = 0;
            Response.Redirect(Request.RawUrl);
        }
        public void AddReply()
        {
            int GID = DataConverter.CLng(Request["GID"]);

            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                function.WriteErrMsg("验证码不正确", Request.RawUrl); return;
            }
            M_GuestBook pinfo = guestBll.GetQuest(GID);
            M_GuestBook info  = new M_GuestBook();
            M_UserInfo  mu    = buser.GetLogin();

            info.UserID   = mu.UserID;
            info.ParentID = GID;
            info.Title    = "[会员回复]";
            info.CateID   = pinfo.CateID;
            info.TContent = BaseClass.CheckInjection(Request.Form["Content"]);
            info.Status   = SiteConfig.SiteOption.OpenAudit > 0 ? 0 : 1;
            guestBll.AddTips(info);
            function.WriteSuccessMsg("回复成功", "GuestShow?Gid=" + GID); return;
        }
Example #19
0
        private string AjaxVaild(string user, string pwd)
        {
            user = user.Trim(); pwd = pwd.Trim();
            if (ValidateCount >= 3)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["vcode"]))
                {
                    return("验证码不正确");
                }
            }
            M_AdminInfo info = B_Admin.AuthenticateAdmin(user, pwd);

            ValidateCount++;
            if (info == null || info.IsNull)
            {
                if (ValidateCount == 3)
                {
                    return("True");
                }
                else
                {
                    return("用户名或密码错误!");
                }
            }
            else if (info.IsLock)
            {
                return("你的帐户被锁定,请与超级管理员联系");
            }
            else
            {
                ZLLog.L(ZLEnum.Log.alogin, "管理员[" + info.UserName + "]登录");
                ValidateCount = 0;
                B_Admin.SetLoginState(HttpContext, info);
            }
            return("True");
        }
        public void Add_Submit()
        {
            AskAuth();
            M_UserInfo mu    = buser.GetLogin();
            int        score = DataConverter.CLng(Request.Form["ddlScore"]);

            if (mu.UserID > 0)
            {
                if (mu.UserExp < score)
                {
                    function.WriteErrMsg("积分不足"); return;
                }
            }
            else if (!GuestConfig.GuestOption.WDOption.IsLogin)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"].Trim()))
                {
                    function.WriteErrMsg("验证码不正确!"); return;
                }
            }
            else
            {
                Response.Redirect("/User/Login?ReturnUrl=/Ask/Add"); return;
            }
            M_Ask askMod = new M_Ask();

            askMod.Qcontent   = Request.Form["txtContent"].Trim();
            askMod.Supplyment = Request.Form["txtSupplyment"].Trim();
            askMod.AddTime    = DateTime.Now;
            askMod.UserId     = mu.UserID;
            askMod.UserName   = mu.UserID > 0 ? mu.UserName : mu.UserName + "[" + mu.WorkNum + "]";
            askMod.Score      = score;
            askMod.IsNi       = DataConverter.CBool(Request.Form["isNi"]) ? 1 : 0;
            askMod.QueType    = Request.Form["subgrade"];
            if (string.IsNullOrEmpty(askMod.QueType))
            {
                askMod.QueType = Request.Form["ddlCate"];
            }
            askMod.Elite  = 0;
            askMod.Status = 1;
            int       flag = askBll.insert(askMod);
            DataTable dts  = askBll.Sel();

            if (score > 0 && buser.CheckLogin())
            {
                //悬赏积分
                buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
                {
                    score     = 0 - score,
                    ScoreType = (int)M_UserExpHis.SType.Point,
                    detail    = mu.UserName + "提交问题[" + askMod.Qcontent + "],扣除悬赏积分-" + score
                });
            }
            //string fix = Request["fix"];
            //if (!string.IsNullOrEmpty(fix))//提交时,若求助对象可见,则向求助对象发送一条短信息
            //{
            //    B_Message message = new B_Message();
            //    M_Message messInfo = new M_Message();
            //    messInfo.Incept = fix;
            //    string UserName = mu.UserName;
            //    messInfo.Sender = mu.UserID.ToString();
            //    messInfo.Title = "来自" + mu.UserName + "的问答求助";
            //    messInfo.PostDate = DateTime.Now;
            //    messInfo.Content = "<a href=\"/Guest/Question/MyAnswer?ID=" + (dts.Rows[0]["ID"]).ToString() + "\" target=\"_blank\">" + askMod.Qcontent + "</a>";
            //    messInfo.Savedata = 0;
            //    messInfo.Receipt = "";
            //    int i = message.GetInsert(messInfo);
            //}
            if (flag > 0 && mu.UserID > 0)
            {
                buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
                {
                    score     = GuestConfig.GuestOption.WDOption.QuestPoint,
                    ScoreType = (int)((M_UserExpHis.SType)(Enum.Parse(typeof(M_UserExpHis.SType), GuestConfig.GuestOption.WDOption.PointType))),
                    detail    = mu.UserName + "提交问题[" + askMod.Qcontent + "],增加问答积分" + GuestConfig.GuestOption.WDOption.QuestPoint
                });
            }
            Response.Redirect("AddSuccess"); return;
        }
        public ActionResult Register_Submit()
        {
            B_UserBaseField bmf      = new B_UserBaseField();
            string          siteurls = SiteConfig.SiteInfo.SiteUrl.TrimEnd('/');

            if (!SiteConfig.UserConfig.EnableUserReg)
            {
                function.WriteErrMsg("服务器已关闭用户注册"); return(null);
            }
            //-----------------------------------
            M_UserInfo info = new M_UserInfo();

            info.UserBase    = new M_Uinfo();
            info.UserName    = Request.Form["TxtUserName"].Replace(" ", "");
            info.UserPwd     = Request.Form["TxtPassword"];
            info.Question    = Request.Form["Question_DP"];
            info.Answer      = Request.Form["TxtAnswer"];
            info.Email       = Request.Form["TxtEmail"].Replace(" ", "");
            info.CheckNum    = function.GetRandomString(10);
            info.GroupID     = DataConverter.CLng(Request.Form["UserGroup"]);
            info.RegisterIP  = EnviorHelper.GetUserIP();
            info.LastLoginIP = info.RegisterIP;
            //info.Purse = SiteConfig.UserConfig.PresentMoney;//注册赠送的余额,积分等
            //info.UserPoint = SiteConfig.UserConfig.PresentPoint;
            //info.UserExp = DataConverter.CLng(SiteConfig.UserConfig.PresentExp);
            info.TrueName = Request.Form["TxtTrueName"];
            info.UserPwd  = StringHelper.MD5(info.UserPwd);;
            //-----------------------------------------------------
            //会员基本信息
            info.UserBase.Address     = Request.Form["TxtAddress"];
            info.UserBase.BirthDay    = Request.Form["TxtBirthday"];
            info.UserFace             = Request.Form["TxtUserFace"];
            info.UserBase.Fax         = Request.Form["TxtFax"];
            info.UserBase.HomePage    = Request.Form["TxtHomepage"];
            info.UserBase.HomePhone   = Request.Form["TxtHomePhone"];
            info.UserBase.IDCard      = Request.Form["TxtIDCard"];
            info.UserBase.Mobile      = Request.Form["TxtMobile"];
            info.UserBase.OfficePhone = Request.Form["TxtOfficePhone"];
            info.UserBase.Privating   = DataConvert.CLng(Request.Form["DropPrivacy"]);
            info.UserBase.PHS         = Request.Form["TxtPHS"];
            info.UserBase.QQ          = Request.Form["TxtQQ"];
            info.UserBase.Sign        = Request.Form["TxtSign"];
            info.UserBase.UserSex     = DataConverter.CBool(Request.Form["DropSex"]);
            info.UserBase.ZipCode     = Request.Form["TxtZipCode"];
            info.UserBase.HoneyName   = "";
            info.UserBase.CardType    = "";
            info.UserBase.Province    = Request["selprovince"];
            info.UserBase.City        = Request["selcity"];
            info.UserBase.County      = Request["selcoutry"];
            if (!string.IsNullOrEmpty(RegisterMobile))
            {
                info.UserBase.Mobile = RegisterMobile; RegisterMobile = null;
            }
            //-----------------------------------------------------
            #region 信息检测
            string err = "";
            if (SiteConfig.UserConfig.EnableCheckCodeOfReg)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
                {
                    function.WriteErrMsg("您输入的验证码和系统产生的不一致,请重新输入", "javascript:history.go(-1);"); return(null);
                }
            }
            if (!CheckUserName(info.UserName, ref err))
            {
                function.WriteErrMsg(err); return(null);
            }
            else if (!CheckUserInfo(info.UserBase))
            {
                return(null);
            }
            else if (string.IsNullOrEmpty(info.Answer))
            {
                function.WriteErrMsg("问题答案不能为空!"); return(null);
            }
            else if (!CheckEmail(info.Email, ref err))
            {
                function.WriteErrMsg(err); return(null);
            }
            #endregion
            //推荐人处理
            M_User_InviteCode utMod = null;
            {
                //支持使用用户名和用户ID
                info.ParentUserID = CheckParentUser(Request.Form["TxtParentUser"]).UserID.ToString();
                //邀请码推荐用户,高于填写的推荐人
                string inviteCode = Request.Form["TxtInvitCode"];
                if (!string.IsNullOrEmpty(inviteCode))
                {
                    utMod = utBll.Code_SelModel(inviteCode);
                    if (utMod != null)
                    {
                        if (utMod.ZStatus != 0)
                        {
                            function.WriteErrMsg("该邀请码已被使用"); return(null);
                        }
                        info.ParentUserID = utMod.UserID.ToString();
                        info.GroupID      = utMod.JoinGroup;
                    }
                }
                //计算深度
                if (DataConvert.CLng(info.ParentUserID) > 0)//从1开始
                {
                    info.RoomID = (buser.SelParentTree(DataConvert.CLng(info.ParentUserID)).Split(',').Length + 1);
                }
            }
            //用于初始状态
            if (SiteConfig.UserConfig.EmailCheckReg)
            {
                info.Status = 4;
            }                                                            //邮件认证
            else if (SiteConfig.UserConfig.AdminCheckReg)
            {
                info.Status = 2;
            }                                                                  //管理员认证
            else if (SiteConfig.UserConfig.EmailCheckReg && SiteConfig.UserConfig.AdminCheckReg)
            {
                info.Status = 3;
            }                                                                                                         //邮件认证及管理员认证
            else if (!SiteConfig.UserConfig.UserValidateType)
            {
                info.Status = 5;
            }
            else
            {
                info.Status = 0;
            }
            //自定义字段信息
            DataTable table;
            try
            {
                table = new Call().GetDTFromMVC(bmf.Select_All(), Request);
            }
            catch (Exception e)
            {
                function.WriteErrMsg(e.Message); return(Content(""));
            }
            string[] strArray2 = string.IsNullOrEmpty(SiteConfig.UserConfig.RegFieldsMustFill) ? new string[0] : SiteConfig.UserConfig.RegFieldsMustFill.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string str2 in strArray2)
            {
                if (Request.Form["txt_" + str2] == null || Request.Form["txt_" + str2] == "")
                {
                    DataTable tbles = bmf.SelByFieldName(str2);
                }
            }
            //------------添加新用户

            info.UserID          = buser.AddModel(info);
            info.UserBase.UserId = info.UserID;
            buser.AddBase(info.UserBase);
            if (table != null && table.Rows.Count > 0)
            {
                buser.UpdateUserFile(info.UserID, table);
            }
            buser.SetLoginState(info);
            if (info.UserID < 1)
            {
                function.WriteErrMsg("注册失败"); return(null);
            }
            //邀请码状态变更
            if (utMod != null)
            {
                utBll.Code_Used(utMod.ID, info);
            }
            //----------------------------------------------------------------------------
            string ReturnUrl  = Request.Form["ReturnUrl_Hid"];
            string RegMessage = "";
            string RegRUrl    = "";
            bool   isok       = false;
            //关联绑定微信用户
            //if (!string.IsNullOrEmpty(WXOpenID))
            //{
            //    B_User_Token tokenBll = new B_User_Token();
            //    M_User_Token tokenMod = tokenBll.SelModelByUid(info.UserID);
            //    if (tokenMod == null) { tokenMod = new M_User_Token(); }
            //    tokenMod.uid = info.UserID;
            //    tokenMod.WXOpenID = WXOpenID;
            //    tokenBll.Insert(tokenMod);
            //}
            #region 自定义模型
            int    ModelID       = DataConverter.CLng(gpBll.GetGroupModel(info.GroupID));
            string usertablename = modBll.GetModelById(ModelID).TableName;
            if (ModelID > 0 && usertablename != "" && usertablename != null)
            {
                DataTable groupset = fieldBll.GetModelFieldListall(ModelID);
                DataTable tablereg = new DataTable();
                tablereg.Columns.Add(new DataColumn("FieldName", typeof(string)));
                tablereg.Columns.Add(new DataColumn("FieldType", typeof(string)));
                tablereg.Columns.Add(new DataColumn("FieldValue", typeof(string)));
                if (groupset != null && groupset.Rows.Count > 0)
                {
                    foreach (DataRow dr in groupset.Rows)
                    {
                        if (dr["FieldType"].ToString() == "FileType")
                        {
                            string[] Sett      = dr["Content"].ToString().Split(new char[] { ',' });
                            bool     chksize   = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]);
                            string   sizefield = Sett[1].Split(new char[] { '=' })[1];
                            if (chksize && sizefield != "")
                            {
                                DataRow row2 = tablereg.NewRow();
                                row2[0] = sizefield;
                                row2[1] = "FileSize";
                                row2[2] = Request.Form["txt_" + sizefield];
                                tablereg.Rows.Add(row2);
                            }
                        }

                        if (dr["FieldType"].ToString() == "MultiPicType")
                        {
                            string[] Sett      = dr["Content"].ToString().Split(new char[] { ',' });
                            bool     chksize   = DataConverter.CBool(Sett[0].Split(new char[] { '=' })[1]);
                            string   sizefield = Sett[1].Split(new char[] { '=' })[1];
                            if (chksize && sizefield != "")
                            {
                                if (string.IsNullOrEmpty(Request.Form["txt_" + sizefield]))
                                {
                                    function.WriteErrMsg(dr["FieldAlias"].ToString() + "的缩略图不能为空!");
                                }
                                DataRow row1 = tablereg.NewRow();
                                row1[0] = sizefield;
                                row1[1] = "ThumbField";
                                row1[2] = Request.Form["txt_" + sizefield];
                                tablereg.Rows.Add(row1);
                            }
                        }

                        DataRow row = tablereg.NewRow();
                        row[0] = dr["FieldName"].ToString();
                        string ftype = dr["FieldType"].ToString();
                        row[1] = ftype;
                        string fvalue = Request.Form["txt_" + dr["FieldName"].ToString()];
                        if (ftype == "TextType" || ftype == "MultipleTextType" || ftype == "MultipleHtmlType")
                        {
                            if (dr["IsNotNull"].Equals("True") && string.IsNullOrEmpty(fvalue))
                            {
                                function.WriteErrMsg(dr["FieldAlias"] + ":不能为空!");
                            }
                        }
                        row[2] = fvalue;
                        tablereg.Rows.Add(row);
                    }
                    try
                    {
                        if (tablereg.Select("FieldName='UserID'").Length == 0)
                        {
                            DataRow rowsd1 = tablereg.NewRow();
                            rowsd1[0] = "UserID";
                            rowsd1[1] = "int";
                            rowsd1[2] = info.UserID;
                            tablereg.Rows.Add(rowsd1);
                        }
                        else
                        {
                            tablereg.Rows[0]["UserID"] = info.UserID;
                        }
                    }
                    catch (Exception)
                    {
                    }

                    try
                    {
                        if (tablereg.Select("FieldName='UserName'").Length == 0)
                        {
                            DataRow rowsd2 = tablereg.NewRow();
                            rowsd2[0] = "UserName";
                            rowsd2[1] = "TextType";
                            rowsd2[2] = info.UserName;
                            tablereg.Rows.Add(rowsd2);
                        }
                        else
                        {
                            tablereg.Rows[0]["UserName"] = info.UserName;
                        }
                    }
                    catch (Exception) { }
                    try
                    {
                        if (tablereg.Select("FieldName='Styleid'").Length == 0)
                        {
                            DataRow rowsd3 = tablereg.NewRow();
                            rowsd3[0] = "Styleid";
                            rowsd3[1] = "int";
                            rowsd3[2] = 0;
                            tablereg.Rows.Add(rowsd3);
                        }
                        else
                        {
                            tablereg.Rows[0]["UserName"] = 0;
                        }
                    }
                    catch (Exception) { }
                    try
                    {
                        if (tablereg.Select("FieldName='Recycler'").Length == 0)
                        {
                            DataRow rowsd4 = tablereg.NewRow();
                            rowsd4[0] = "Recycler";
                            rowsd4[1] = "int";
                            rowsd4[2] = 0;
                            tablereg.Rows.Add(rowsd4);
                        }
                        else
                        {
                            tablereg.Rows[0]["Recycler"] = 0;
                        }
                    }
                    catch (Exception) { }
                    try
                    {
                        if (tablereg.Select("FieldName='IsCreate'").Length == 0)
                        {
                            DataRow rowsd5 = tablereg.NewRow();
                            rowsd5[0] = "IsCreate";
                            rowsd5[1] = "int";
                            rowsd5[2] = 0;
                            tablereg.Rows.Add(rowsd5);
                        }
                        else
                        {
                            tablereg.Rows[0]["IsCreate"] = 0;
                        }
                    }
                    catch (Exception) { }
                    try
                    {
                        if (tablereg.Select("FieldName='NewTime'").Length == 0)
                        {
                            DataRow rs6 = tablereg.NewRow();
                            rs6[0] = "NewTime";
                            rs6[1] = "DateType";
                            rs6[2] = DateTime.Now;
                            tablereg.Rows.Add(rs6);
                        }
                        else
                        {
                            tablereg.Rows[0]["NewTime"] = DateTime.Now;
                        }
                    }
                    catch (Exception) { }
                }

                if (tablereg != null && tablereg.Rows.Count > 0)
                {
                    buser.InsertModel(tablereg, usertablename);
                }
            }
            #endregion
            if (SiteConfig.UserConfig.EmailCheckReg && !string.IsNullOrEmpty(info.Email))//发送认证邮件,当需要邮件认证时
            {
                MailInfo mailInfo = new MailInfo();
                mailInfo.IsBodyHtml = true;
                mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                MailAddress address = new MailAddress(info.Email);
                mailInfo.ToAddress = address;
                string regurl      = siteurls + "/User/RegisterCheck?UserName="******"&CheckNum=" + info.CheckNum;
                string mailcontent = mailBll.SelByType(B_MailManage.MailType.NewUserReg);
                mailInfo.MailBody = new OrderCommon().TlpDeal(mailcontent, GetRegEmailDt(info.UserName, info.CheckNum, regurl));
                mailInfo.Subject  = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码";
                if (SendMail.Send(mailInfo) == SendMail.MailState.Ok)
                {
                    RegMessage = "注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!";
                    RegMessage = RegMessage + "<a href=\"/\">返回首页</a>";
                }
                else
                {
                    RegMessage = "注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!";
                    RegMessage = RegMessage + "<a href=\"/\">返回首页</a>";
                }
            }
            switch (info.Status)
            {
            case 0:
                #region 直接注册成功
                if (!string.IsNullOrEmpty(info.Email) && SiteConfig.UserConfig.EmailTell)
                {
                    MailInfo mailInfo = new MailInfo();
                    mailInfo.IsBodyHtml = true;
                    mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                    MailAddress address = new MailAddress(info.Email);
                    mailInfo.ToAddress = address;
                    //SiteConfig.UserConfig.EmailOfRegCheck
                    string regurl = siteurls + "/User/RegisterCheck?UserName="******"&CheckNum=" + info.CheckNum;
                    mailInfo.MailBody = new OrderCommon().TlpDeal(mailBll.SelByType(B_MailManage.MailType.NewUserReg), GetRegEmailDt(info.UserName, info.CheckNum, regurl));
                    //mailInfo.MailBody = mailInfo.MailBody.Replace("{$UserName}", info.UserName).Replace("{$UserPwd}", TxtPassword.Text);
                    mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "_注册成功提醒";
                    if (SendMail.Send(mailInfo) == SendMail.MailState.Ok)
                    {
                        RegMessage = "注册基本信息已成功发送到你的注册邮箱!";
                        RegMessage = RegMessage + "<a href=\"/\">返回首页</a>";
                    }
                    else
                    {
                        RegMessage = "注册成功,但发送注册基本信息邮件失败,请检查邮件地址是否正确,或与网站管理员联系!";
                        RegMessage = RegMessage + "<a href=\"/\">返回首页</a>";
                    }
                }
                else
                {
                    RegMessage = "注册成功!";
                    if (string.IsNullOrEmpty(ReturnUrl))
                    {
                        RegMessage = RegMessage + "<a href=\"/\">返回首页</a>&nbsp;&nbsp;<a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!";
                        RegRUrl    = "/User/Index";
                    }
                    else
                    {
                        RegMessage = RegMessage + "<a href=\"/\">返回首页</a>&nbsp;&nbsp;<a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!";
                        RegRUrl    = ReturnUrl;
                    }
                    isok = true;
                }
                #endregion
                break;

            case 2:     //等待管理员认证
                RegMessage = "注册成功!新注册会员需管理员认证才能有效,请耐心等待!";
                RegMessage = RegMessage + "若长期没有通过管理员认证,请及时和管理员联系!";
                RegMessage = RegMessage + "<a href=\"/\">返回首页</a>";
                break;

            default:
                //未开启邮箱验证,则可以登录
                if (!SiteConfig.UserConfig.EmailCheckReg)
                {
                    RegMessage = "注册成功!";
                }
                if (string.IsNullOrEmpty(ReturnUrl))
                {
                    RegMessage = RegMessage + "<a href=\"/\">返回首页</a>&nbsp;&nbsp;<a href=\"/User/Index\">进入会员中心</a>,5秒后系统自动跳转到会员中心!";
                    RegRUrl    = "default";
                }
                else
                {
                    RegMessage = RegMessage + "<a href=\"/\">返回首页</a>&nbsp;&nbsp;<a href=\"" + ReturnUrl + "\">进入默认页面</a>,5秒后系统自动跳转到默认页面!";
                    RegRUrl    = ReturnUrl;
                }
                isok = true;
                break;
            }
            if (SiteConfig.UserConfig.EmailCheckReg)
            {
                RegMessage = "<div class='emptyDiv'><br/>注册成功! &nbsp;&nbsp;<a href='http://mail." + info.Email.Substring(info.Email.LastIndexOf('@') + 1) + "' target='_blank'>立即登录邮箱进行验证>></a><br/></div>";
                isok       = false;
            }
            ViewBag.RegMessage = RegMessage;
            ViewBag.RegRUrl    = RegRUrl;
            ViewBag.isok       = isok;//为true则自动跳转
            ViewBag.pwd        = Request.Form["TxtPassword"];
            return(View("Register_Finish", info));
        }
Example #22
0
        // 发表评论
        protected string SenderComm()
        {
            M_UserInfo mu = buser.GetLogin(false);

            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))//Need
            {
                return("-1");
            }
            M_Comment comment = new M_Comment();

            comment.CommentID = 0;
            comment.GeneralID = ItemID;
            M_CommonData cdata = bll.GetCommonData(ItemID);

            if (cdata.IsComm != 1)
            {
                return("-4");
            }
            //GetNodePreate(cdata.NodeID);
            M_Node mnode = nodeBll.GetNodeXML(cdata.NodeID);

            if (mnode.CommentType.Equals("2") && !buser.CheckLogin())
            {
                return("-2");
            }

            comment.UserID = mu.UserID;//支持一个支持匿名方法
            comment.Title  = BaseClass.CheckInjection(this.HdnTitle.Value);
            if (string.IsNullOrEmpty(Request.Form["content"]))
            {
                return("-3");
            }
            comment.Contents = BaseClass.CheckInjection(sll.ProcessSen(Request.Form["content"]));
            comment.Audited  = false;
            DataTable dts = bcomment.SeachComment_ByGeneralID2(ItemID);

            if (mnode.Purview != null && mnode.Purview != "")
            {
                string    Purview = mnode.Purview;
                DataTable AuitDT  = nodeBll.GetNodeAuitDT(mnode.Purview);
                if (AuitDT == null && AuitDT.Rows.Count <= 0)
                {
                    return("-4");
                }
                DataRow auitdr  = AuitDT.Rows[0];
                string  forum_v = auitdr["forum"].ToString();
                if (string.IsNullOrEmpty(forum_v))
                {
                    return("-4");
                }
                string[] forumarr = forum_v.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                if (!forumarr.Contains("1"))//不允许评论
                {
                    return("-4");
                }
                if (!forumarr.Contains("2"))//不需要审核
                {
                    comment.Audited = true;
                }
                if (forumarr.Contains("3")) //一个文章只评论一次
                {
                    if (bcomment.SearchByUser(mu.UserID, cdata.NodeID).Rows.Count > 0)
                    {
                        return("-5");
                    }
                }
            }
            comment.Status      = 0;
            comment.Score       = DataConverter.CLng(Request.Form["Score"]);
            comment.CommentTime = DateTime.Now;
            DataTable dt = bcomment.SeachComment_ByGeneralID2(ItemID);

            if (bcomment.Add(comment))
            {
                if (SiteConfig.UserConfig.CommentRule > 0 && mu.UserID > 0)//增加积分
                {
                    buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
                    {
                        score     = SiteConfig.UserConfig.CommentRule,
                        detail    = "发表评论增加积分",
                        ScoreType = (int)M_UserExpHis.SType.Point
                    });
                }
            }
            return(comment.Audited ? "2" : "1");
        }
Example #23
0
        public ContentResult UserCheck()
        {
            M_AJAXUser ajaxUser = new M_AJAXUser();
            string     action   = GetParam("action");

            retMod.retcode = M_APIResult.Success;
            switch (action)
            {
            case "HasLogged":
                mu = buser.GetLogin();
                if (mu != null && !mu.IsNull)
                {
                    ajaxUser.Copy(mu);
                    return(Content(ajaxUser.ToJson()));
                }
                else
                {
                    return(Content("-1"));
                }

            case "GetBarUInfo":
            {
                int uid = Convert.ToInt32(GetParam("uid"));
                mu = buser.GetUserByUserID(uid);
                M_Uinfo ubMod  = buser.GetUserBaseByuserid(uid);
                string  result = "{\"UserFace\":\"" + ubMod.UserFace + "\",\"UserExp\":\"" + mu.UserExp + "\",\"UserSex\":\"" + (ubMod.UserSex ? "男" : "女") + "\",\"GroupName\":\"" + gpBll.GetByID(DataConverter.CLng(mu.GroupID)).GroupName + "\",\"UserBirth\":\"" + ubMod.BirthDay + "\",\"RegTime\":\"" + mu.RegTime + "\",\"UserID\":\"" + mu.UserID + "\",\"UserName\":\"" + mu.UserName + "\"}";
                return(Content(result));
            }

            case "CheckKey":
                string     chkUname = GetParam("uname");
                M_UserInfo usermod  = buser.GetUserByName(chkUname);
                if (usermod != null && !string.IsNullOrEmpty(usermod.ZnPassword))
                {
                    return(Content("1"));
                }
                else
                {
                    return(Content("-1"));
                }

            case "UserLogin":
            {
                string key   = GetParam("key");
                string uname = GetParam("uname");
                string upwd  = GetParam("upwd");
                mu = buser.AuthenticateUser(uname, upwd);
                if (mu.IsNull)
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "登录失败,用户名或密码错误";
                }
                else
                {
                    ajaxUser.Copy(mu);
                    retMod.result = ajaxUser.ToJson();
                }
                return(Content(retMod.ToString()));
            }
            break;

            case "GetUser":    //用于远程登录等,返回基本用户信息
            {
                string uname = RequestEx["uname"];
                string upwd  = RequestEx["upwd"];       //未加密的
                mu = buser.AuthenticateUser(uname, upwd);
                if (mu.IsNull)
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "用户不存在";
                }
                else
                {
                    ajaxUser.Copy(mu);
                    retMod.retmsg = ajaxUser.ToJson();
                }
                return(Content(retMod.ToString()));
            }
            break;

            case "ExistEmail":
            {
                string email = RequestEx["email"];
                if (buser.IsExistMail(email))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "邮箱已存在!";
                }
                return(Content(retMod.ToString()));
            }
            break;

            case "ExistUName":
            {
                string uname = RequestEx["uname"];
                if (buser.IsExistUName(uname))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "用户名已存在";
                }
                return(Content(retMod.ToString()));
            }
            break;

            case "ExistMobile":
            {
                string mobile = RequestEx["mobile"];
                if (buser.IsExist("mobile", mobile))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "手机号已存在";
                }
                return(Content(retMod.ToString()));
            }
            break;

            case "exist_ue":    //检测用户名与邮箱(选填)
            {
                string email = RequestEx["email"];
                string uname = RequestEx["uname"];
                if (buser.IsExistUName(uname))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "用户名已存在";
                }
                if (!string.IsNullOrEmpty(email))
                {
                    if (buser.IsExistMail(email))
                    {
                        retMod.retcode = M_APIResult.Failed; retMod.retmsg = "邮箱已存在!";
                    }
                }
                return(Content(retMod.ToString()));
            }

            case "exist_um":    //用户名与手机号(选填)
            {
                string uname  = RequestEx["uname"];
                string mobile = RequestEx["mobile"];
                if (buser.IsExistUName(uname))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "用户名已存在";
                }
                if (!string.IsNullOrEmpty(mobile))
                {
                    if (buser.IsExist("mobile", mobile))
                    {
                        retMod.retcode = M_APIResult.Failed; retMod.retmsg = "手机号已存在";
                    }
                }
                return(Content(retMod.ToString()));
            }

            case "exist_ume":
            {
                string uname = RequestEx["uname"];
                if (buser.IsExist("ume", uname))
                {
                    retMod.retcode = M_APIResult.Failed; retMod.retmsg = "用户名已存在";
                }
                return(Content(retMod.ToString()));
            }

            case "spwd":
            {
                retMod.retcode = M_APIResult.Failed;
                mu             = buser.GetLogin(false);
                string spwd = RequestEx["spwd"];
                if (string.IsNullOrEmpty(mu.PayPassWord))
                {
                    retMod.retmsg = "用户未设置支付密码,验证失败";
                }
                else if (!mu.PayPassWord.Equals(StringHelper.MD5(spwd)))
                {
                    retMod.retmsg = "支付密码错误";
                }
                else if (mu.PayPassWord.Equals(StringHelper.MD5(spwd)))
                {
                    retMod.retcode = M_APIResult.Success;
                }
                else
                {
                    retMod.retmsg = "支付密码错误";
                }
                return(Content(retMod.ToString()));
            }

            case "Login":
            default:    //Login
                #region -1登录失败,-2验证码失败,-10启用验证码
            {
                string value = RequestEx["value"];
                string uname = value.Split(':')[0], upwd = value.Split(':')[1];
                //兼容以前旧版未加密请求
                if (upwd.Length > 10)
                {
                    upwd = ZoomlaSecurityCenter.SiteDecrypt(upwd);
                }
                if (LoginCount >= 3)        //验证码
                {
                    var key = value.Split(':')[2]; var code = value.Split(':')[3];
                    if (key.StartsWith("{"))        //新验证码
                    {
                        int    start = value.IndexOf("{");
                        int    end   = value.LastIndexOf("}");
                        string json  = value.Substring(start, end - start + 1);
                        if (!VerifyHelper.Check(json))
                        {
                            return(Content("-2"));
                        }
                    }
                    else if (!ZoomlaSecurityCenter.VCodeCheck(key, code))
                    {
                        return(Content("-2"));
                    }
                }
                mu = buser.AuthenticateUser(uname, upwd);
                if (mu == null || mu.IsNull)
                {
                    LoginCount++;
                    if (LoginCount >= 3)
                    {
                        return(Content("-10"));
                    }
                    else
                    {
                        return(Content("-1"));
                    }
                }
                else
                {
                    LoginCount = 0;
                    buser.SetLoginState(mu, "Day");
                    ajaxUser.Copy(mu);
                    return(Content(ajaxUser.ToJson()));
                }
            }
                #endregion
                break;
            }
        }
Example #24
0
        public IActionResult Post_Add()
        {
            //Mid,CateID
            M_UserInfo mu = tuBll.GetLogin(); //buser.GetLogin();

            if (mu.Status != 0)
            {
                return(WriteErr("您的账户已被锁定,无法进行发帖、回复等操作!"));
            }
            int    pid   = DataConvert.CLng(RequestEx["pid"]);
            string title = Request.Form["MsgTitle_T"];
            string msg   = Request.Form["MsgContent_T"];

            //如果内容来源于手机编辑器,则合并图片与转化表情
            if (DataConvert.CStr(Request.Form["editor"]).Equals("mbeditor"))
            {
                msg = msg.Replace("\r\n", "<br />");
                string imgs = Request.Form["txt_bar"], emotions = Request.Form["ImgFace_Hid"];
                if (!string.IsNullOrEmpty(emotions))
                {
                    string    imgTlp = "<img src='/Plugins/Ueditor/dialogs/emotion/{0}' class='imgface_img' />";
                    DataTable dt     = JsonHelper.JsonToDT(emotions);
                    foreach (DataRow dr in dt.Rows)
                    {
                        msg = msg.Replace(dr["title"].ToString(), string.Format(imgTlp, dr["realurl"].ToString()));
                    }
                }
                if (!string.IsNullOrEmpty(imgs) && !imgs.Equals("[]"))
                {
                    string imgHtml = "";
                    string imgTlp  = "<img src='{0}'>";
                    //[{"url":"/UploadFiles/User/user/admin1/20180627EvVVMk.jpg","desc":""}]
                    DataTable dt = JsonHelper.JsonToDT(imgs);
                    foreach (DataRow dr in dt.Rows)
                    {
                        imgHtml += string.Format(imgTlp, DataConvert.CStr(dr["url"]));
                    }
                    msg += "<div>" + imgHtml + "</div>";
                }
            }
            string base64Msg     = StrHelper.CompressString(msg);
            string rurl          = RequestEx["rurl"];//操作完成后返回哪个链接
            bool   auth_barowner = false;

            if (pid > 0)//回复主贴
            {
                M_Guest_Bar pmod = barBll.SelReturnModel(pid);
                CateID = pmod.CateID;
            }
            if (Mid > 0)//编辑贴子
            {
                barMod = barBll.SelReturnModel(Mid);
                CateID = barMod.CateID;
            }
            M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID);

            if (cateMod == null)
            {
                return(WriteErr("栏目不存在"));
            }
            rurl          = string.IsNullOrEmpty(rurl) ? "/PClass?id=" + cateMod.CateID : rurl;
            auth_barowner = cateMod.IsBarOwner(mu.UserID);
            if (Mid > 0)//编辑
            {
                if (barMod.CUser != mu.UserID && !auth_barowner)
                {
                    return(WriteErr("你无权修改该内容"));
                }
                barMod.Title      = title;
                barMod.SubTitle   = GetSubTitle(ref msg);
                barMod.MsgContent = base64Msg;
                barBll.UpdateByID(barMod);
            }
            else
            {
                if (pid < 1 && string.IsNullOrEmpty(title))
                {
                    return(WriteErr("贴子标题不能为空!"));
                }
                if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"]))
                {
                    return(WriteErr("验证码不正确"));
                }
                if (!auth_barowner)//非管理员需要检测权限和接受限制
                {
                    //是否可在该版块发贴子
                    if (!authBll.AuthCheck(cateMod, mu, "send"))
                    {
                        return(WriteErr("你无权在[" + cateMod.CateName + "]版块发布贴子"));
                    }
                    //是否有时间限制
                    M_Guest_Bar lastMod   = barBll.SelLastModByUid(mu);
                    BarOption   baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID);
                    int         usertime  = baroption == null ? 120 : baroption.UserTime;
                    int         sendtime  = baroption == null ? 5 : baroption.SendTime;
                    if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限
                    {
                        int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes;
                        return(WriteErr("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);"));
                    }
                    else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime)
                    {
                        int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes;
                        return(WriteErr("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);"));
                    }
                }
                barMod    = FillMsg(title, msg, pid, 0, cateMod);
                barMod.ID = barBll.Insert(barMod);
                if (pid < 1)
                {
                    rurl = "/PItem?ID=" + barMod.ID;
                }
                if (cateMod.Status == 1 && mu.UserID > 0 && cateMod.SendScore > 0)//是否需审核
                {
                    buser.AddMoney(mu.UserID, cateMod.SendScore, M_UserExpHis.SType.Point, string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, cateMod.CateName, barMod.Title, cateMod.SendScore));
                }
            }
            return(Redirect(rurl));
        }
        public void Post_Add()
        {
            //Mid,CateID
            M_UserInfo mu = tuBll.GetLogin(); //buser.GetLogin();

            if (mu.Status != 0)
            {
                function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!"); return;
            }
            int    pid           = DataConvert.CLng(Request.QueryString["pid"]);
            string title         = Request.Form["MsgTitle_T"];
            string msg           = Request.Form["MsgContent_T"];
            string base64Msg     = StrHelper.CompressString(msg);
            string rurl          = Request["rurl"];//操作完成后返回哪个链接
            bool   auth_barowner = false;

            if (pid > 0)//回复主贴
            {
                M_Guest_Bar pmod = barBll.SelReturnModel(pid);
                CateID = pmod.CateID;
            }
            if (Mid > 0)//编辑贴子
            {
                barMod = barBll.SelReturnModel(Mid);
                CateID = barMod.CateID;
            }
            M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID);

            if (cateMod == null)
            {
                function.WriteErrMsg("栏目不存在"); return;
            }
            rurl          = string.IsNullOrEmpty(rurl) ? "/PClass?id=" + cateMod.CateID : rurl;
            auth_barowner = cateMod.IsBarOwner(mu.UserID);
            if (Mid > 0)//编辑
            {
                if (barMod.CUser != mu.UserID && !auth_barowner)
                {
                    function.WriteErrMsg("你无权修改该内容"); return;
                }
                barMod.Title      = title;
                barMod.SubTitle   = GetSubTitle(ref msg);
                barMod.MsgContent = base64Msg;
                barBll.UpdateByID(barMod);
            }
            else
            {
                if (pid < 1 && string.IsNullOrEmpty(title))
                {
                    function.WriteErrMsg("贴子标题不能为空!"); return;
                }
                if (!ZoomlaSecurityCenter.VCodeCheck(Request["VCode_hid"], Request["VCode"]))
                {
                    function.WriteErrMsg("验证码不正确"); return;
                }
                if (!auth_barowner)//非管理员需要检测权限和接受限制
                {
                    //是否可在该版块发贴子
                    if (!authBll.AuthCheck(cateMod, mu, "send"))
                    {
                        function.WriteErrMsg("你无权在[" + cateMod.CateName + "]版块发布贴子"); return;
                    }
                    //是否有时间限制
                    M_Guest_Bar lastMod   = barBll.SelLastModByUid(mu);
                    BarOption   baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID);
                    int         usertime  = baroption == null ? 120 : baroption.UserTime;
                    int         sendtime  = baroption == null ? 5 : baroption.SendTime;
                    if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限
                    {
                        int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes;
                        function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);"); return;
                    }
                    else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime)
                    {
                        int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes;
                        function.WriteErrMsg("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);"); return;
                    }
                }
                barMod = FillMsg(title, msg, pid, 0, cateMod);
                barBll.Insert(barMod);
                if (cateMod.Status == 1 && mu.UserID > 0 && cateMod.SendScore > 0)//是否需审核
                {
                    buser.AddMoney(mu.UserID, cateMod.SendScore, M_UserExpHis.SType.Point, string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, cateMod.CateName, barMod.Title, cateMod.SendScore));
                }
            }
            Response.Redirect(rurl); return;
        }
Example #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (function.isAjax())
        {
            ProcAjax();
        }
        if (Pid <= 0)
        {
            function.WriteErrMsg("参数错误!不存在此信息!");
        }
        M_Pub mpub = pubBll.GetSelect(Pid);

        if (mpub != null && mpub.Pubid > 0)
        {
            #region 是否需要登录PubLogin
            if (mpub.PubLogin == 1)
            {
                string logstr = mpub.PubLoginUrl;
                if (!buser.CheckLogin())
                {
                    if (string.IsNullOrEmpty(logstr))
                    {
                        Response.Redirect("/User/Login.aspx?ReturnUrl=" + Request.UrlReferrer.PathAndQuery);
                    }
                    else
                    {
                        Response.Redirect(logstr);
                    }
                    Response.End();
                }
            }
            #endregion
            #region 是否已经结束
            if (mpub.PubEndTime < DateTime.Now)
            {
                function.WriteErrMsg("Sorry,此互动已经结束!不接收任何提交的数据!");
                Response.End();
            }
            #endregion
            ////是否存在此模型
            //if (modBll.GetModelById(pubinfo.PubModelID).ModelID == 0)
            //{
            //    function.WriteErrMsg("Sorry,不存在此模型!");
            //    Response.End();
            //}
            ////模型表是否存在
            //string tablename = modBll.GetModelById(pubinfo.PubModelID).TableName;
            //try
            //{
            //    mfBll.SelectTableName(tablename, " 1=1");
            //}
            //catch
            //{
            //    function.WriteErrMsg("Sorry,此互动的模型表不存在!");
            //    Response.End();
            //}
            string cookflag     = Request.Cookies["cookflag"] == null ? "" : Request.Cookies["cookflag"].Value;
            string PubInputer   = Request.Form["PubInputer"];
            int    PubContentid = DataConverter.CLng(Request.Form["PubContentid"]);
            //初始化参数
            int pubitemid = 0;
            int Pubnum = 0;
            int Parentid = 0;
            int userid = 0; string username = "";
            //IP可发信息数量
            int pubipnum = mpub.PubIPOneOrMore;
            //是否需要审核
            bool isinto = false;
            //用户提交
            string pbtitle   = Server.HtmlEncode(Request.Form["PubTitle"]);
            string pbcontent = Server.HtmlEncode(Request.Form["PubContent"]);
            //-----------------------------------------------------------------
            if (mpub.PubCode == 1)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["PostValidateCode"]))
                {
                    Response.Write("<script>alert('验证码错误!');window.history.go(-1);</script>");
                    Response.Flush();
                    Response.End();
                }
            }
            if (buser.CheckLogin())
            {
                M_UserInfo mu = buser.GetLogin();
                userid   = mu.UserID;
                username = mu.UserName;
            }
            //查找是否存在主题
            DataTable temptable = mfBll.SelectTableName(mpub.PubTableName, "PubContentid=" + PubContentid + " and Pubupid=" + Pid + " and Parentid=0");
            //同IP的同一篇文章回复次数
            int msgCount = pubBll.SelMsgCount(mpub, PubContentid, mpub.Pubid, EnviorHelper.GetUserIP());
            //最后回复时间
            DataTable selecttime = mfBll.SelectTableName(mpub.PubTableName, "PubContentid=" + PubContentid + " and Pubupid=" + Pid + " and PubIP='" + EnviorHelper.GetUserIP() + "' order by id desc");
            //判断是否存在,获得数据的值
            if (temptable.Rows.Count > 0)
            {
                pubitemid = DataConverter.CLng(temptable.Rows[0]["ID"]);
                Pubnum    = DataConverter.CLng(temptable.Rows[0]["Pubnum"]);
            }
            //删除超过保留期限的值
            pubBll.DeleteModel(mpub.PubTableName, "DateDiff(d,PubAddTime,getdate())>" + mpub.Pubkeep);
            switch (pubipnum)
            {
            case 0:
                Parentid = 0;
                isinto   = true;
                break;

            case 1:    //Only One
                Parentid = temptable.Rows.Count == 0 ? 0 : Parentid = DataConverter.CLng(temptable.Rows[0]["ID"]);
                isinto   = msgCount < 1;
                break;

            default:
                Parentid = temptable.Rows.Count == 0 ? 0 : Parentid = DataConverter.CLng(temptable.Rows[0]["ID"]);
                isinto   = msgCount < pubipnum;
                break;
            }
            //开启cookies身份判断(主用于移动端例如微信浏览器)
            if (isinto && mpub.PubFlag == 1 && Request.Cookies["cookflag"] != null)
            {
                if (string.IsNullOrEmpty(cookflag))
                {
                    function.WriteErrMsg("身份信息不正确,无法参与互动!");
                }
                SqlParameter[] sp        = new SqlParameter[] { new SqlParameter("cookflag", cookflag) };
                string         sql       = " cookflag=@cookflag";
                DataTable      pubinfoDT = mfBll.SelectTableName(mpub.PubTableName, sql, sp);
                if (pubinfoDT.Rows.Count >= mpub.PubTimeSlot)
                {
                    function.WriteErrMsg("很抱歉,每人只能提交" + mpub.PubFlag + "次");
                    isinto = false;
                }
            }
            //用户信息数量限制
            if (isinto && mpub.PubOneOrMore > 0 && !string.IsNullOrEmpty(username))
            {
                SqlParameter[] sp2       = new SqlParameter[] { new SqlParameter("uname", username) };
                string         sql2      = "PubContentid=" + PubContentid + " and Pubupid=" + mpub.Pubid + " and PubUserName=@uname order by id desc";
                DataTable      pubinfoDT = mfBll.SelectTableName(mpub.PubTableName, sql2, sp2);
                if (mpub.PubOneOrMore == 3)
                {
                    if (pubinfoDT.Select("PubUserID=" + userid).Length > 1)
                    {
                        function.WriteErrMsg("很抱歉,对于此次互动,您只能参与一次!");
                    }
                }
                isinto = pubinfoDT.Rows.Count < mpub.PubOneOrMore;
            }
            if (!isinto)//不符合添加条件
            {
                if (!string.IsNullOrEmpty(mpub.Puberrmsg))
                {
                    Response.Write("<script>alert('" + mpub.Puberrmsg + "');window.history.go(-1);</script>");
                }
                else
                {
                    Response.Write("<script>window.history.go(-1);</script>");
                }
                Response.End();
                return;
            }
            DateTime PubAddTimes = DateTime.MinValue;
            if (selecttime.Rows.Count > 0 && Parentid > 0)
            {
                PubAddTimes = DataConverter.CDate(selecttime.Rows[0]["PubAddTime"]);
            }
            //TimeSpan timespan = DateTime.Now - PubAddTimes;//时间间隔,用于限定用户第二次提交限制
            //double TotalSecondsnum = timespan.TotalSeconds;
            //ModelField表中仅存了自定义的字段
            B_CodeModel codeBll = new B_CodeModel(mpub.PubTableName);
            DataRow     dr      = codeBll.NewModel();
            DataTable   mfDT    = mfBll.DB_SelByModel(mpub.PubModelID);
            mfDT.DefaultView.RowFilter = "sys_type=0";
            mfDT = mfDT.DefaultView.ToTable();
            //-----固定的系统字段
            dr["Pubnum"]       = 1;
            dr["PubIP"]        = EnviorHelper.GetUserIP();
            dr["PubUserID"]    = userid;
            dr["PubUserName"]  = username;
            dr["Pubupid"]      = mpub.Pubid;
            dr["PubAddTime"]   = DateTime.Now;
            dr["Parentid"]     = DataConvert.CLng(Request.Form["Parentid"]);
            dr["PubTitle"]     = pbtitle;
            dr["PubContent"]   = pbcontent;
            dr["Pubstart"]     = mpub.PubIsTrue == 1 ? 0 : 1;//取反
            dr["PubInputer"]   = PubInputer;
            dr["PubContentid"] = PubContentid;
            dr["cookflag"]     = cookflag;

            //------非系统字段
            for (int i = 0; i < mfDT.Rows.Count; i++)
            {
                M_ModelField mfMod = new M_ModelField().GetModelFromReader(mfDT.Rows[i]);
                string       value = Server.HtmlEncode(Request.Form[mfMod.FieldName] ?? "");
                Parentid = DataConvert.CLng(Request.Form["Parentid"]);
                if (mfMod.IsNotNull && string.IsNullOrEmpty(value))
                {
                    Response.Write("<script>alert('" + mfMod.FieldName + "不能为空!');window.history.go(-1);</script>");
                    Response.End();
                }
                dr[mfMod.FieldName] = value;
                switch (mpub.PubType)
                {
                    #region 根据互动类型,进行空值判断
                case 0:
                    if (string.IsNullOrEmpty(pbcontent))
                    {
                        Response.Write("<script>alert('评论内容不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    break;

                case 1:
                    if (string.IsNullOrEmpty(pbtitle))
                    {
                        Response.Write("<script>alert('标题不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    break;

                case 2:
                    if (string.IsNullOrEmpty(pbtitle))
                    {
                        Response.Write("<script>alert('标题不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    if (string.IsNullOrEmpty(pbcontent))
                    {
                        Response.Write("<script>alert('活动信息不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    break;

                case 3:
                    if (string.IsNullOrEmpty(pbtitle) || string.IsNullOrEmpty(pbcontent))
                    {
                        Response.Write("<script>alert('标题与内容不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    break;

                case 4:
                    if (string.IsNullOrEmpty(pbtitle))
                    {
                        Response.Write("<script>alert('标题不能为空!');window.history.go(-1);</script>");
                        Response.End();
                    }
                    break;

                case 5:
                    break;

                case 7:    //将评星控件的数据写入数据表中
                    dr["PubContent"] = Request.Params["scoreVal"];
                    break;

                case 8:    //互动表单
                    break;
                    #endregion
                }
                //if (Parentid > 0)
                //{
                //    //更新主题信息
                //    SqlParameter[] sqlparacc = new SqlParameter[1];
                //    sqlparacc[0] = new SqlParameter("Pubnum", SqlDbType.Int);
                //    sqlparacc[0].Value = Pubnum + 1;
                //    pubBll.UpdateModel(sqlparacc, mpub.PubTableName, "id=" + pubitemid.ToString() + "");
                //}
            }
            codeBll.Insert(dr);
            Upaddnums(mpub); //更新总参与人数
        }
    }