示例#1
0
 protected string SetUserGroup(object author)
 {
     string userType = "";
     if (author != null)
     {
         B_User userBll = new B_User();
         M_User userModel = userBll.GetUser(author.ToString());
         B_UserGroup userGroupBll = new B_UserGroup();
         DataTable dt = userGroupBll.ManageList("");
         if (dt.Rows.Count > 0 && userModel != null)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (dt.Rows[i]["UserGroupId"].ToString() == userModel.GroupID.ToString())
                 {
                     userType = dt.Rows[i]["UserGroupName"].ToString();
                     break;
                 }
             }
         }
     }
     else
     {
         userType = "游客";
     }
     return userType;
 }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InfoTable.Visible = false;
        B_User user = new B_User();
        M_User userModel = user.GetUser(user.GetCookie().UserID);

        B_SiteInfo site = new B_SiteInfo();
        M_Site siteModel = site.GetSiteModel();
        if (userModel != null)
        {
            if (siteModel.IsOpenInvite)
            {
                B_UserGroup groupBll = new B_UserGroup();
                string integral = groupBll.Power_UserGroup("Invite", 0, groupBll.GetModel(userModel.GroupID).GroupPower);
                lbIntegral.Text = integral;
                if (siteModel.Domain.EndsWith("/"))
                {
                    txtUrl.Text = siteModel.Domain + "user/Reg.aspx?TypeId=" + userModel.TypeId + "&recmd_uid=" + userModel.UserID;
                }
                else
                {
                    txtUrl.Text = siteModel.Domain + "/user/Reg.aspx?TypeId=" + userModel.TypeId + "&recmd_uid=" + userModel.UserID;
                }
            }
            else
            {
                InfoTable.Visible = true;
                MainTable.Visible = false;
            }
        }
        else
        {
            Response.Redirect("Login.aspx");
        }
    }
示例#3
0
 public void Integral(int Value, string UserName)
 {
     M_User user = new B_User().GetUser(UserName);
     if (user != null)
     {
         this.Integral(Value, user.UserID);
     }
 }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     B_User User = new B_User();
     User.CheckIsLogin();
     string qryStr = Request.QueryString["path"];
     if (!string.IsNullOrEmpty(qryStr))
     {
         img.ImageUrl = Param.ApplicationRootPath + "/Upload/User/" + Function.UrlDecode(qryStr);
     }
 }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        B_User user = new B_User();

        user.ExpireCookie();

        B_Create createBll = new B_Create();
        Response.Write("<script>history.back();</script>");
    }
示例#6
0
文件: B_User.cs 项目: suizhikuo/KYCMS
 public void AddCmdUserIntegral(int recmd_uid)
 {
     M_User user = new B_User().GetUser(recmd_uid);
     B_Money money = new B_Money();
     if (user != null)
     {
         B_UserGroup group = new B_UserGroup();
         int num = int.Parse(group.Power_UserGroup("Invite", 0, group.GetModel(user.GroupID).GroupPower));
         money.Integral(num, recmd_uid);
     }
 }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //更新在线状态(最好是放到 Session_End 里面去执行)
        Response.Cache.SetNoStore();
        B_User user = new B_User();
        M_User userModel = user.GetCookie();

        B_Create createBll = new B_Create();
        bbsUserBll.LoginOut(userModel.LogName);

        user.ExpireCookie();
        bbsUserBll.ClearUserCookie();
         if (!string.IsNullOrEmpty(Request.QueryString["returnurl"]))
        {
            returnUrl = Request.QueryString["returnurl"];
        }
        if (returnUrl != string.Empty)
        {
            Response.Redirect(returnUrl);
        }
        Response.Redirect(createBll.GetIndexUrl());
    }
示例#8
0
 private string GetTotal()
 {
     StringBuilder builder = new StringBuilder();
     DataView list = this.ChannelBll.GetList(false);
     list.RowFilter = "isdeleted=0 and isdisabled=0";
     for (int i = 0; i < list.Count; i++)
     {
         int chId = (int)list[i]["chid"];
         string str = list[i]["chname"].ToString();
         int modelId = (int)list[i]["modeltype"];
         string str2 = list[i]["typeUnit"].ToString();
         string tableName = this.GetTableName(modelId);
         if (tableName == string.Empty)
         {
             return string.Empty;
         }
         int recordCount = 0;
         this.InfoOperBll.GetInfoList(tableName, "", "", chId, "0", "-99", "", "", "", -1, 1, 1, ref recordCount);
         builder.Append(string.Format("{0}:{1}{2}<br/>", str, recordCount, str2));
     }
     list.Dispose();
     int userCount = new B_User().GetUserCount(0, 0);
     builder.Append(string.Format("会员总计:{0}个<br/>", userCount));
     return builder.ToString();
 }
示例#9
0
 private string GetCurrentUserInfo(string paramStr, DataRow dr)
 {
     string paramValue = "0";
     this.GetParamValue(paramStr, "userstyle", ref paramValue);
     string styleContent = this.GetStyleContent(int.Parse(paramValue));
     int num = int.Parse(dr["usertype"].ToString());
     int userId = int.Parse(dr["uid"].ToString());
     if (num == 0)
     {
         DataRow userAllInfo = new B_User().GetUserAllInfo(userId);
         if (userAllInfo == null)
         {
             return string.Empty;
         }
         MatchCollection styleFileldName = this.GetStyleFileldName(styleContent);
         StringBuilder builder = new StringBuilder(styleContent);
         foreach (Match match in styleFileldName)
         {
             if (match.Groups.Count > 1)
             {
                 string input = match.Groups[1].Value.Trim().ToLower();
                 string apiName = string.Empty;
                 string param = string.Empty;
                 Match match2 = Regex.Match(input, @"(.*?)#(.*?)\((.*?)\)");
                 if (match2.Success)
                 {
                     input = match2.Groups[1].Value;
                     apiName = match2.Groups[2].Value;
                     param = match2.Groups[3].Value;
                 }
                 builder.Replace(match.Value, this.GetCommonFieldForInfo(userAllInfo, input, apiName, param));
             }
         }
         return builder.ToString();
     }
     return string.Empty;
 }
示例#10
0
        public string Info_Ajax(string paramStr, DataRow dr, int pageIndex, int pageCount, int pos)
        {
            Match match;
            string str9;
            string str10;
            string str11;
            string paramValue = "";
            string input = "";
            string str3 = "yyyy-mm-dd";
            string newValue = "";
            string infoCloseUrl = "";
            string infoCloseName = "";
            string str7 = "";
            this.GetParamValue(paramStr, "style", ref paramValue);
            this.GetParamValue(paramStr, "dateformat", ref str3);
            input = this.GetStyleContent(int.Parse(paramValue));
            if (pos == 0)
            {
                match = Regex.Match(input, @"<ky_hidden>(?:.|\n)*<ky_no_login>((?:.|\n)*?)</ky_no_login>(?:.|\n)*</ky_hidden>", RegexOptions.IgnoreCase);
                if (!match.Success)
                {
                    return string.Empty;
                }
                input = match.Groups[1].Value;
            }
            else if (pos == 1)
            {
                match = Regex.Match(input, @"<ky_hidden>(?:.|\n)*<ky_no_pay>((?:.|\n)*?)</ky_no_pay>(?:.|\n)*</ky_hidden>", RegexOptions.IgnoreCase);
                if (!match.Success)
                {
                    return string.Empty;
                }
                input = match.Groups[1].Value;
                string replacement = string.Concat(new object[] { Param.ApplicationRootPath, "/common/dofee.aspx?modelid=", dr["modelid"], "&infoid=", dr["id"] });
                input = Regex.Replace(match.Groups[1].Value, "{@feeurl}", replacement);
            }
            else if (pos == 2)
            {
                match = Regex.Match(input, @"<ky_hidden>(?:.|\n)*<ky_pay>((?:.|\n)*?)</ky_pay>(?:.|\n)*</ky_hidden>", RegexOptions.IgnoreCase);
                if (!match.Success)
                {
                    return string.Empty;
                }
                input = match.Groups[1].Value;
            }
            else
            {
                return string.Empty;
            }
            MatchCollection matchs = Regex.Matches(input, "{ky_user_(.*?)}", RegexOptions.IgnoreCase);
            if (matchs.Count > 0)
            {
                int num = int.Parse(dr["usertype"].ToString());
                int userId = int.Parse(dr["uid"].ToString());
                if (num == 0)
                {
                    DataRow userAllInfo = new B_User().GetUserAllInfo(userId);
                    foreach (Match match2 in matchs)
                    {
                        str9 = match2.Groups[1].Value.Trim().ToLower();
                        str10 = string.Empty;
                        str11 = string.Empty;
                        Match match3 = Regex.Match(str9, @"(.*?)#(.*?)\((.*?)\)");
                        if (match3.Success)
                        {
                            str9 = match3.Groups[1].Value;
                            str10 = match3.Groups[2].Value;
                            str11 = match3.Groups[3].Value;
                        }
                        string fieldName = str9;
                        if (userAllInfo == null)
                        {
                            input = input.Replace(match2.Value, "");
                        }
                        else
                        {
                            input = input.Replace(match2.Value, this.GetCommonFieldForUserInfo(userAllInfo, fieldName, str10, str11));
                        }
                    }
                }
            }
            MatchCollection styleFileldName = this.GetStyleFileldName(input);
            DataTable table = this.CreateDataTable();
            DataTable table2 = this.CreateDataTable1();
            int modelId = (int)dr["modelid"];
            foreach (Match match4 in styleFileldName)
            {
                string str13 = string.Empty;
                if (match4.Groups.Count > 1)
                {
                    str13 = match4.Groups[1].Value.ToLower();
                }
                else
                {
                    return string.Empty;
                }
                str9 = str13;
                str10 = string.Empty;
                str11 = string.Empty;
                Match match5 = Regex.Match(str9, @"(.*?)#(.*?)\((.*?)\)");
                if (match5.Success)
                {
                    str9 = match5.Groups[1].Value;
                    str10 = match5.Groups[2].Value;
                    str11 = match5.Groups[3].Value;
                }
                switch (str9)
                {
                    case "content":
                        if ((modelId != 1) && (modelId != 2))
                        {
                            break;
                        }
                        input = input.Replace(match4.Value, this.GetPageIndexContent(dr, pageIndex));
                        goto Label_0929;

                    case "hitcount":
                        input = input.Replace(match4.Value, this.GetInfoHitCount(dr));
                        goto Label_0929;

                    case "title":
                        input = input.Replace(match4.Value, this.GetInfoTitle(dr, 0));
                        goto Label_0929;

                    case "tagnamestr":
                        input = input.Replace(match4.Value, this.GetInfoTagNameStr(dr, false));
                        goto Label_0929;

                    case "pre":
                        newValue = this.GetInfoCloseName(dr, "pre");
                        input = input.Replace(match4.Value, newValue);
                        goto Label_0929;

                    case "preurl":
                        infoCloseUrl = this.GetInfoCloseUrl(dr, "pre");
                        input = input.Replace(match4.Value, infoCloseUrl);
                        goto Label_0929;

                    case "next":
                        infoCloseName = this.GetInfoCloseName(dr, "next");
                        input = input.Replace(match4.Value, infoCloseName);
                        goto Label_0929;

                    case "nexturl":
                        str7 = this.GetInfoCloseUrl(dr, "next");
                        input = input.Replace(match4.Value, str7);
                        goto Label_0929;

                    case "titleimgpath":
                        input = input.Replace(match4.Value, this.GetInfoTitleImg(dr));
                        goto Label_0929;

                    case "imgpath":
                        if (modelId != 2)
                        {
                            goto Label_0737;
                        }
                        input = input.Replace(match4.Value, this.GetImgPath(dr, pageIndex));
                        goto Label_0929;

                    case "addresspath":
                        if (modelId != 3)
                        {
                            goto Label_0780;
                        }
                        input = input.Replace(match4.Value, this.GetAddress(dr));
                        goto Label_0929;

                    case "downloaddownnum":
                        if (modelId != 3)
                        {
                            goto Label_07CA;
                        }
                        input = input.Replace(match4.Value, this.GetDownCount(dr, 1));
                        goto Label_0929;

                    case "downloaddownmonthnum":
                        if (modelId != 3)
                        {
                            goto Label_0814;
                        }
                        input = input.Replace(match4.Value, this.GetDownCount(dr, 2));
                        goto Label_0929;

                    case "downloaddownweeknum":
                        if (modelId != 3)
                        {
                            goto Label_085E;
                        }
                        input = input.Replace(match4.Value, this.GetDownCount(dr, 3));
                        goto Label_0929;

                    case "downloaddowndaynum":
                        if (modelId != 3)
                        {
                            goto Label_08A8;
                        }
                        input = input.Replace(match4.Value, this.GetDownCount(dr, 4));
                        goto Label_0929;

                    case "addtime":
                        input = input.Replace(match4.Value, this.GetDateTime(dr, str3));
                        goto Label_0929;

                    case "dig":
                        input = input.Replace(match4.Value, this.GetDig("", (int)dr["id"], modelId));
                        goto Label_0929;

                    default:
                        input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                        goto Label_0929;
                }
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_0737:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_0780:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_07CA:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_0814:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_085E:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
                goto Label_0929;
            Label_08A8:
                input = input.Replace(match4.Value, this.GetCommonFieldForInfo(dr, str13, str10, str11));
            Label_0929: ;
            }
            return input;
        }
示例#11
0
        public string Info(string paramStr, DataRow dr, int pageId, int PageSize)
        {
            int num3;
            string paramValue = "";
            string input = "";
            string str3 = "yyyy-mm-dd";
            string newValue = "";
            string infoCloseUrl = "";
            string infoCloseName = "";
            string str7 = "";
            this.GetParamValue(paramStr, "style", ref paramValue);
            this.GetParamValue(paramStr, "dateformat", ref str3);
            input = this.GetStyleContent(int.Parse(paramValue));
            ArrayList list = new ArrayList();
            Match match = Regex.Match(input, @"((?:.|\n)*?)<ky_hidden>((?:.|\n)*?)</ky_hidden>((?:.|\n)*)", RegexOptions.IgnoreCase);
            int num = int.Parse(dr["pointcount"].ToString());
            int num2 = int.Parse(dr["id"].ToString());
            string str8 = dr["tablename"].ToString();
            if (match.Success)
            {
                for (num3 = 1; num3 < match.Groups.Count; num3++)
                {
                    list.Add(match.Groups[num3].Value);
                }
            }
            else
            {
                list.Add(input);
            }
            string str9 = string.Empty;
            for (num3 = 0; num3 < list.Count; num3++)
            {
                MatchCollection matchs;
                string str10;
                string str11;
                string str12;
                if (num3 == 1)
                {
                    if (num > 0)
                    {
                        input = string.Format("<script language=\"javascript\">GetHiddenContent(\"{0}\",\"{1}\",{2},{3},{4},\"{5}\")</script>", new object[] { Param.ApplicationRootPath + "/common/GetHiddenContent.aspx", Ky.Common.Function.UrlEncode(paramStr), num2, pageId, PageSize, str8 });
                        str9 = str9 + input;
                    }
                    else
                    {
                        Match match2 = Regex.Match(list[num3].ToString(), @"<ky_pay>((?:.|\n)*?)</ky_pay>", RegexOptions.IgnoreCase);
                        if (match2.Success)
                        {
                            input = match2.Groups[1].Value;
                            goto Label_0207;
                        }
                    }
                    continue;
                }
                input = list[num3].ToString();
            Label_0207:
                matchs = Regex.Matches(input, "{ky_user_(.*?)}", RegexOptions.IgnoreCase);
                if (matchs.Count > 0)
                {
                    int num4 = int.Parse(dr["usertype"].ToString());
                    int userId = int.Parse(dr["uid"].ToString());
                    if (num4 == 0)
                    {
                        DataRow userAllInfo = new B_User().GetUserAllInfo(userId);
                        foreach (Match match3 in matchs)
                        {
                            str10 = match3.Groups[1].Value.Trim().ToLower();
                            str11 = string.Empty;
                            str12 = string.Empty;
                            Match match4 = Regex.Match(str10, @"(.*?)#(.*?)\((.*?)\)");
                            if (match4.Success)
                            {
                                str10 = match4.Groups[1].Value;
                                str11 = match4.Groups[2].Value;
                                str12 = match4.Groups[3].Value;
                            }
                            string fiedName = str10;
                            if (userAllInfo == null)
                            {
                                input = input.Replace(match3.Value, "");
                            }
                            else
                            {
                                input = input.Replace(match3.Value, this.GetCommonFiled(userAllInfo, fiedName, str11, str12));
                            }
                        }
                    }
                }
                MatchCollection styleFileldName = this.GetStyleFileldName(input);
                DataTable table = this.CreateDataTable();
                DataTable table2 = this.CreateDataTable1();
                int modelId = (int)dr["modelid"];
                foreach (Match match5 in styleFileldName)
                {
                    string fieldName = string.Empty;
                    if (match5.Groups.Count > 1)
                    {
                        fieldName = match5.Groups[1].Value.ToLower();
                    }
                    else
                    {
                        return string.Empty;
                    }
                    str10 = fieldName;
                    str11 = string.Empty;
                    str12 = string.Empty;
                    Match match6 = Regex.Match(str10, @"(.*?)#(.*?)\((.*?)\)");
                    if (match6.Success)
                    {
                        str10 = match6.Groups[1].Value;
                        str11 = match6.Groups[2].Value;
                        str12 = match6.Groups[3].Value;
                    }
                    switch (str10)
                    {
                        case "content":
                            if ((modelId != 1) && (modelId != 2))
                            {
                                break;
                            }
                            input = input.Replace(match5.Value, this.GetPageIndexContent(dr, pageId));
                            goto Label_095C;

                        case "hitcount":
                            input = input.Replace(match5.Value, this.GetInfoHitCount(dr));
                            goto Label_095C;

                        case "title":
                            input = input.Replace(match5.Value, this.GetInfoTitle(dr, 0));
                            goto Label_095C;

                        case "tagnamestr":
                            input = input.Replace(match5.Value, this.GetInfoTagNameStr(dr, false));
                            goto Label_095C;

                        case "pre":
                            newValue = this.GetInfoCloseName(dr, "pre");
                            input = input.Replace(match5.Value, newValue);
                            goto Label_095C;

                        case "preurl":
                            infoCloseUrl = this.GetInfoCloseUrl(dr, "pre");
                            input = input.Replace(match5.Value, infoCloseUrl);
                            goto Label_095C;

                        case "next":
                            infoCloseName = this.GetInfoCloseName(dr, "next");
                            input = input.Replace(match5.Value, infoCloseName);
                            goto Label_095C;

                        case "nexturl":
                            str7 = this.GetInfoCloseUrl(dr, "next");
                            input = input.Replace(match5.Value, str7);
                            goto Label_095C;

                        case "titleimgpath":
                            input = input.Replace(match5.Value, this.GetInfoTitleImg(dr));
                            goto Label_095C;

                        case "imgpath":
                            if (modelId != 2)
                            {
                                goto Label_076A;
                            }
                            input = input.Replace(match5.Value, this.GetImgPath(dr, pageId));
                            goto Label_095C;

                        case "addresspath":
                            if (modelId != 3)
                            {
                                goto Label_07B3;
                            }
                            input = input.Replace(match5.Value, this.GetAddress(dr));
                            goto Label_095C;

                        case "downloaddownnum":
                            if (modelId != 3)
                            {
                                goto Label_07FD;
                            }
                            input = input.Replace(match5.Value, this.GetDownCount(dr, 1));
                            goto Label_095C;

                        case "downloaddownmonthnum":
                            if (modelId != 3)
                            {
                                goto Label_0847;
                            }
                            input = input.Replace(match5.Value, this.GetDownCount(dr, 2));
                            goto Label_095C;

                        case "downloaddownweeknum":
                            if (modelId != 3)
                            {
                                goto Label_0891;
                            }
                            input = input.Replace(match5.Value, this.GetDownCount(dr, 3));
                            goto Label_095C;

                        case "downloaddowndaynum":
                            if (modelId != 3)
                            {
                                goto Label_08DB;
                            }
                            input = input.Replace(match5.Value, this.GetDownCount(dr, 4));
                            goto Label_095C;

                        case "addtime":
                            input = input.Replace(match5.Value, this.GetDateTime(dr, str3));
                            goto Label_095C;

                        case "dig":
                            input = input.Replace(match5.Value, this.GetDig("", (int)dr["id"], modelId));
                            goto Label_095C;

                        default:
                            input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                            goto Label_095C;
                    }
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_076A:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_07B3:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_07FD:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_0847:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_0891:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                    goto Label_095C;
                Label_08DB:
                    input = input.Replace(match5.Value, this.GetCommonFieldForInfo(dr, fieldName, str11, str12));
                Label_095C: ;
                }
                str9 = str9 + input;
            }
            return str9;
        }
示例#12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CustomFormId = int.Parse(Request.QueryString["CustomFormId"]);
        dtIsUser = BCustomFormField.GetIsUserList(CustomFormId);
        MCustomForm = BCustomForm.GetModel(CustomFormId);

        if (!Page.IsPostBack)
        {
            //验证
            GetIsOk();

            if (MCustomForm.IsValidate)
            {
                string validateCode = string.Empty;
                if (Session["ValidateCode"] == null)
                {
                    Function.ShowMsg(0, "<li>你在页面停留的时间过长,验证码已经失效</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
                }

                validateCode = Session["ValidateCode"].ToString();
                //验证码错误
                if (validateCode != Request.Form["txtValidate"].Trim().ToLower())
                {
                    Function.ShowMsg(0, "<li>验证码错误</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
                }
            }

            int sUId = 0;
            string sUName = "匿名用户";

            if (BUser.IsLogin())
            {
                sUId = BUser.GetCookie().UserID;
                sUName = BUser.GetUser(BUser.GetCookie().UserID).LogName;
            }

            //只允许提交一次
            if (MCustomForm.IsSubmitNum)
            {
                //判断是否多次提交
                if (!Function.ReadTempCookies("CustomForm_" + CustomFormId, CustomFormId.ToString()))
                {
                    Function.SaveTempCookies("CustomForm_" + CustomFormId, CustomFormId.ToString());
                }
                else
                {
                    Function.ShowMsg(0, "<li>" + MCustomForm.FormName + "设置用户只能够提交一次数据</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
                }
            }

            //金币
            if (sUId != 0)
            {
                B_User buser = new B_User();
                M_User muser = buser.GetUser(sUId);

                if (muser.YellowBoy + MCustomForm.Money < 0)
                {
                    Function.ShowMsg(0, "<li>你剩余的金币不足,无法提交该表单</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
                }
                else
                {
                    BMoney.YellowBoy(MCustomForm.Money, sUId);
                }
            }

            string TableName = MCustomForm.TableName;

            //定义DataTable
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("FieldName", typeof(string)));
            dt.Columns.Add(new DataColumn("FieldValue", typeof(string)));

            #region 系统默认字段
            DataRow dr1 = dt.NewRow();
            dr1[0] = "UId";
            dr1[1] = sUId;
            dt.Rows.Add(dr1);

            DataRow dr2 = dt.NewRow();
            dr2[0] = "UName";
            dr2[1] = sUName;
            dt.Rows.Add(dr2);

            DataRow dr3 = dt.NewRow();
            dr3[0] = "Ip";
            dr3[1] = Request.ServerVariables["REMOTE_ADDR"];
            dt.Rows.Add(dr3);

            DataRow dr4 = dt.NewRow();
            dr4[0] = "AddTime";
            dr4[1] = DateTime.Now.ToString();
            dt.Rows.Add(dr4);

            #endregion

            //以下是自动添加字段获得值
            for (int i = 0; i < dtIsUser.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = dtIsUser.Rows[i]["Name"].ToString();

                switch (dtIsUser.Rows[i]["Type"].ToString())
                {
                    case "ListBoxType":
                        if (Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == "" || Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""] == null)
                        {
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        }
                        else
                        {
                            dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""].Replace(" ", "").ToString();
                        }
                        break;
                    case "MultipleTextType":
                        dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        break;
                    default:
                        dr[1] = Request.Form["txt_" + dtIsUser.Rows[i]["Name"].ToString() + ""];
                        break;
                }
                dt.Rows.Add(dr);
            }

            //添加信息
            BInfoModel.AddInfoModel(dt, TableName);

            Function.ShowMsg(1, "<li>成功提交信息</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");

            dtIsUser.Clear();
            dtIsUser.Dispose();
        }
    }
示例#13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        bool reviewIsCheck = false;
        B_Review bll = new B_Review();
        B_SiteInfo SiteBll = new B_SiteInfo();
        B_User bllUser = new B_User();
        M_Review model = new M_Review();
        M_User userModel = null;
        if (Request.Form["txtIsLogin"] == "False")
        {
            if (Request.Form["btnSubmit"] == "登录")
            {
                bool flaglogin = true;
                string msgBox = string.Empty;
                if (Request.Form["UserName"].ToString().Trim() == "")
                {
                    flaglogin = false;
                    msgBox = "<script>alert('用户名必须填写');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                }
                else if (Request.Form["userPwd"].ToString().Trim() == "")
                {
                    flaglogin = false;
                    msgBox = "<script>alert('密码必须填写');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                }
                if (flaglogin)
                {

                    ltMsg.Text = "";
                    string logName = "";
                    string pwd = "";
                    string cookieType = "";

                    logName = Function.UrlDecode(Request.Form["UserName"].ToString());
                    pwd = Function.MD5Encrypt(Request.Form["userPwd"].ToString());
                    cookieType = "No";

                    if ((!string.IsNullOrEmpty(logName)) && (!string.IsNullOrEmpty(pwd)))
                    {
                        B_SiteInfo siteInfo = new B_SiteInfo();
                        M_Site siteModel = siteInfo.GetSiteModel();
                        M_User modelLogin = bllUser.GetUser(logName);
                        if (modelLogin != null && siteModel != null)
                        {

                                //用户登录
                                bool flag = bllUser.Login(logName, pwd);
                                if (flag && (!string.IsNullOrEmpty(cookieType)))
                                {
                                    HttpCookie cookie = new HttpCookie("User");
                                    cookie["uId"] = modelLogin.UserID.ToString();
                                    cookie["logN"] = modelLogin.LogName;
                                    cookie["pd"] = modelLogin.UserPwd;
                                    switch (cookieType)
                                    {
                                        case "onehour":
                                            cookie.Expires = DateTime.Now.AddHours(1);
                                            break;
                                        case "oneday":
                                            cookie.Expires = DateTime.Now.AddDays(1);
                                            break;
                                        case "oneweek":
                                            cookie.Expires = DateTime.Now.AddDays(7);
                                            break;
                                        case "onemounth":
                                            cookie.Expires = DateTime.Now.AddMonths(1);
                                            break;
                                        case "oneyear":
                                            cookie.Expires = DateTime.Now.AddYears(1);
                                            break;
                                        case "No":
                                        default:
                                            break;
                                    }
                                    Response.Cookies.Add(cookie);

                                    string lastLoginIP = string.Empty;
                                    if (Request.UserHostAddress != null)
                                    {
                                        lastLoginIP = Request.UserHostAddress;
                                    }
                                    DateTime currLoginTime = DateTime.Now;
                                    DateTime oldLoginTime = modelLogin.LastLoginTime;
                                    bllUser.LoginSuccess(modelLogin.UserID, lastLoginIP, currLoginTime);
                                    if (oldLoginTime.Date != currLoginTime.Date)
                                    {
                                        B_Money moneyBll = new B_Money();
                                        moneyBll.Integral(siteModel.LoginScore, modelLogin.UserID);
                                    }

                                    msgBox = "<script>alert('登录成功');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                                }
                                else
                                {
                                    msgBox = "<script>alert('登录失败');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                                }
                        }
                        else
                        {
                            msgBox = "<script>alert('登录失败');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                        }
                    }
                }
                    ltMsg.Text = msgBox;
            }
            else
            {
                if (Request.Form["hidNoName"].ToString() == "False")
                {
                    ltMsg.Text = "<script>alert('本系统设置了不允许匿名评论,请先登录');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                }
                else
                {
                    //根据栏目的设置,对论评论审核进行初始化
                    if (Request.Form["hidColCommentSet"].ToString() == "True")
                        reviewIsCheck = false;
                    else
                        reviewIsCheck = true;

                    string validateCode = string.Empty;
                    string flag = Request.Form["hidValidate"];
                    if (flag == "True")
                    {
                        if (Session["ValidateCode"] == null)
                        {
                            Response.Write("<script language='javascript'>alert('你在登陆页面停留的时间过长,验证码已经失效');window.history.back();</script>");
                            Response.End();
                        }
                        //验证码错误
                        validateCode = Session["ValidateCode"].ToString().ToLower();
                        if (validateCode.ToLower() != Request.Form["txtValidate"].ToString().Trim().ToLower())
                        {
                            Response.Write("<script language='javascript'>alert('验证码错误');window.history.back();</script>");
                            Response.End();
                        }
                    }

                    if (bllUser.IsLogin())
                    {
                        M_User loginUserModel = bllUser.GetCookie();
                        userModel = bllUser.GetUser(loginUserModel.LogName);
                    }

                    model.ModelType = int.Parse(Request.Form["hidModeType"].ToString());
                    model.InfoId = Request.Form["hidNewsId"].ToString();

                    if (Request.Form["hidUserGroupViewIsCheck"] == "True" && bllUser.IsLogin())
                        reviewIsCheck = true;
                    model.IsCheck = reviewIsCheck;

                    model.ReviewTitle = "";                                    //评论标题

                    model.IsArgue = false;
                    model.IsSquare = 3;

                    model.BrarNum = 0;
                    model.FightNum = 0;

                    model.IsElite = false;
                    model.ReviewContent = SiteBll.GetFiltering(Request.Form["txtContent"].ToString());           //评论内容
                    model.ReviewTime = DateTime.Now;                                                       //评论时间
                    if (bllUser.IsLogin())                                             //是否是登录用户
                        model.UserNum = userModel.UserID.ToString();
                    else
                        model.UserNum = "0";
                    model.ReviewIP = Request.UserHostAddress;     //评论用户的IP

                    if (bll.Add(model))
                    {
                        if (!reviewIsCheck)
                            ltMsg.Text = "<script>alert('评论成功,将在审核后显示出来');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                        else
                            ltMsg.Text = "<script>window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                    }
                }
            }
        }
        else
        {
            if (Request.Form["hidNoName"].ToString() == "False")
            {
                ltMsg.Text = "<script>alert('本系统设置了不允许匿名评论,请先登录');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
            }
            else
            {
                //根据栏目的设置,对论评论审核进行初始化
                if (Request.Form["hidColCommentSet"].ToString() == "True")
                    reviewIsCheck = false;
                else
                    reviewIsCheck = true;

                string validateCode = string.Empty;
                string flag = Request.Form["hidValidate"];
                if (flag == "True")
                {
                    if (Session["ValidateCode"] == null)
                    {
                        Response.Write("<script language='javascript'>alert('你在登陆页面停留的时间过长,验证码已经失效');window.history.back();</script>");
                        Response.End();
                    }
                    //验证码错误
                    validateCode = Session["ValidateCode"].ToString().ToLower();
                    if (validateCode.ToLower() != Request.Form["txtValidate"].ToString().Trim().ToLower())
                    {
                        Response.Write("<script language='javascript'>alert('验证码错误');window.history.back();</script>");
                        Response.End();
                    }
                }

                if (bllUser.IsLogin())
                {
                    M_User loginUserModel = bllUser.GetCookie();
                    userModel = bllUser.GetUser(loginUserModel.LogName);
                }

                model.ModelType = int.Parse(Request.Form["hidModeType"].ToString());
                model.InfoId = Request.Form["hidNewsId"].ToString();
                if (Request.Form["hidUserGroupViewIsCheck"] == "True" && bllUser.IsLogin())
                    reviewIsCheck = true;
                model.IsCheck = reviewIsCheck;

                model.ReviewTitle = "";                                    //评论标题

                model.IsArgue = false;
                model.IsSquare = 3;

                model.BrarNum = 0;
                model.FightNum = 0;

                model.IsElite = false;
                model.ReviewContent = SiteBll.GetFiltering(Request.Form["txtContent"].ToString());           //评论内容
                model.ReviewTime = DateTime.Now;                                                       //评论时间
                if (bllUser.IsLogin())                                             //是否是登录用户
                    model.UserNum = userModel.UserID.ToString();
                else
                    model.UserNum = "0";
                model.ReviewIP = Request.UserHostAddress;     //评论用户的IP

                if (bll.Add(model))
                {
                    if (!reviewIsCheck)
                        ltMsg.Text = "<script>alert('评论成功,将在审核后显示出来');window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                    else
                        ltMsg.Text = "<script>window.location.href('" + Request.UrlReferrer.ToString() + "');</script>";
                }
            }
        }
    }
示例#14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Form["subjectflagl"] != null)
        {
            string subjectId = Request.Form["subjectflagl"].ToString();
            if (Request.Cookies[subjectId] != null)
            {
                Response.Write("<script>alert('你已经投过票了');window.history.back();</script>");
            }
            else
            {
                int ItemNum1 = 0;
                int ItemNum2 = 0;
                int ItemNum3 = 0;
                int ItemNum4 = 0;
                int ItemNum5 = 0;
                int ItemNum6 = 0;
                string[] voteIdArr = Request.Form["hidvoteIdAll"].ToString().Substring(0, Request.Form["hidvoteIdAll"].ToString().Length - 1).Split(',');
                foreach (string voteId in voteIdArr)
                {
                    B_Vote bllVote = new B_Vote();
                    B_User userBll = new B_User();
                    M_Vote mUpdateVote = new M_Vote();
                    M_Vote mVote = bllVote.GetVoteIdbyInfo(int.Parse(voteId.ToString()));

                    DataTable dt = bllVote.GetSubject((int)mVote.SubjectId);
                    if (dt != null && dt.Rows.Count != 0)
                    {
                        if ((DateTime)dt.Rows[0]["EndDate"] < DateTime.Now.Date)
                        {
                            Response.Write("<script>alert('此投票主题已过期');window.history.back();</script>");
                            return;
                        }
                        if (dt.Rows[0]["RequireLogin"].ToString() == "True" && !userBll.IsLogin())
                        {
                            Response.Write("<script>alert('请登录后再投票');window.history.back();</script>");
                            return;
                        }
                    }
                    HttpCookie ipCookie = new HttpCookie(subjectId);
                    ipCookie.Value = Request.UserHostAddress;
                    ipCookie.Expires = DateTime.Now.AddHours(2);
                    Response.Cookies.Add(ipCookie);

                    ItemNum1 = mVote.ItemNum1;
                    ItemNum2 = mVote.ItemNum2;
                    ItemNum3 = mVote.ItemNum3;
                    ItemNum4 = mVote.ItemNum4;
                    ItemNum5 = mVote.ItemNum5;
                    ItemNum6 = mVote.ItemNum6;
                    string[] voteItem = null;
                    if (Request.Form[voteId + "vote"] != null)
                    {
                        voteItem = Request.Form[voteId + "vote"].ToString().Split(',');
                        foreach (string ItemValue in voteItem)
                        {
                            if (ItemValue == "ItemNum1")
                                ItemNum1 = ItemNum1 + 1;
                            if (ItemValue == "ItemNum2")
                                ItemNum2 = ItemNum2 + 1;
                            if (ItemValue == "ItemNum3")
                                ItemNum3 = ItemNum3 + 1;
                            if (ItemValue == "ItemNum4")
                                ItemNum4 = ItemNum4 + 1;
                            if (ItemValue == "ItemNum5")
                                ItemNum5 = ItemNum5 + 1;
                            if (ItemValue == "ItemNum6")
                                ItemNum6 = ItemNum6 + 1;

                            mUpdateVote.ItemNum1 = ItemNum1;
                            mUpdateVote.ItemNum2 = ItemNum2;
                            mUpdateVote.ItemNum3 = ItemNum3;
                            mUpdateVote.ItemNum4 = ItemNum4;
                            mUpdateVote.ItemNum5 = ItemNum5;
                            mUpdateVote.ItemNum6 = ItemNum6;
                            mUpdateVote.VoteId = int.Parse(voteId.ToString());
                            mUpdateVote.VoteTitle = mVote.VoteTitle;
                            mUpdateVote.IsMore = mVote.IsMore;
                            mUpdateVote.ItemTitle1 = mVote.ItemTitle1;
                            mUpdateVote.ItemTitle2 = mVote.ItemTitle2;
                            mUpdateVote.ItemTitle3 = mVote.ItemTitle3;
                            mUpdateVote.ItemTitle4 = mVote.ItemTitle4;
                            mUpdateVote.ItemTitle5 = mVote.ItemTitle5;
                            mUpdateVote.ItemTitle6 = mVote.ItemTitle6;
                            bllVote.UpdateVote(mUpdateVote);
                        }
                    }
                }
                Response.Write("<script>alert('投票成功');window.history.back();</script>");
            }
        }
    }
示例#15
0
文件: B_User.cs 项目: suizhikuo/KYCMS
 public bool IsLogin()
 {
     B_User user = new B_User();
     if (HttpContext.Current.Request.Cookies["User"] == null)
     {
         return false;
     }
     string logName = string.Empty;
     string str2 = string.Empty;
     if (HttpContext.Current.Request.Cookies["User"]["logN"] != null)
     {
         logName = Ky.Common.Function.UrlDecode(HttpContext.Current.Request.Cookies["User"]["logN"]);
     }
     if (HttpContext.Current.Request.Cookies["User"]["pd"] != null)
     {
         str2 = Ky.Common.Function.UrlDecode(HttpContext.Current.Request.Cookies["User"]["pd"]);
     }
     if ((logName == string.Empty) || (str2 == string.Empty))
     {
         return false;
     }
     M_User user2 = null;
     user2 = user.GetUser(logName);
     if ((user2 == null) || (user2.UserPwd != str2))
     {
         return false;
     }
     return true;
 }
示例#16
0
 public void Auditing(string tableName, string idStr, int status)
 {
     if (idStr != string.Empty)
     {
         B_Admin admin = new B_Admin();
         B_Column column = new B_Column();
         B_Channel channel = new B_Channel();
         string[] strArray = idStr.Split(new char[] { ',' });
         foreach (string str in strArray)
         {
             int id = int.Parse(str);
             DataRow info = this.dal.GetInfo(tableName, id);
             if (info == null)
             {
                 break;
             }
             int columnId = (int) info["colid"];
             M_Column column2 = column.GetColumn(columnId);
             if (column2 == null)
             {
                 break;
             }
             M_Channel channel2 = channel.GetChannel(column2.ChId);
             if (channel2 == null)
             {
                 break;
             }
             int num3 = (int) info["Status"];
             int num4 = (int) info["UserType"];
             int userId = (int) info["UId"];
             string str2 = info["UName"].ToString();
             string newValue = info["Title"].ToString();
             string str4 = channel2.Notice2.Replace("{@标题}", newValue);
             M_LoginAdmin loginModel = admin.GetLoginModel();
             int adiminId = loginModel.UserId;
             string loginName = loginModel.LoginName;
             this.dal.Auditing(tableName, id, status, adiminId, loginName);
             if ((((status == 3) && (num3 != 3)) && (num4 == 0)) && (userId > 0))
             {
                 B_WebMessage message = new B_WebMessage();
                 M_WebMessage message2 = new M_WebMessage();
                 message2.Title = "稿件采纳通知";
                 message2.Content = str4;
                 message2.IsRead = 0;
                 message2.IsSend = 1;
                 message2.ReceiverId = userId;
                 message2.ReceiverName = str2;
                 message2.SendId = 0;
                 message2.SendName = loginName;
                 message2.OverdueDate = DateTime.Now;
                 message2.AddDate = DateTime.Now;
                 message2.ReceiverDel = 0;
                 message2.SendDel = 0;
                 message.Insert(message2);
             }
             M_User user = new B_User().GetUser(userId);
             if (user == null)
             {
                 break;
             }
             B_UserGroup group = new B_UserGroup();
             M_UserGroup model = group.GetModel(user.GroupID);
             if (group == null)
             {
                 break;
             }
             int num7 = int.Parse(group.Power_UserGroup("Contribute", 0, model.GroupPower)) * column2.ScoreReward;
             new B_Money().Integral(num7, userId);
         }
     }
 }
示例#17
0
 private void UserCateBound()
 {
     B_User userBll = new B_User();
     DataTable dt = userBll.GetUserCateList(UserModel.UserID, ChannelModel.ModelType);
     ddlUserCate.DataTextField = "CateName";
     ddlUserCate.DataValueField = "UserCateId";
     ddlUserCate.DataSource = dt;
     ddlUserCate.DataBind();
     ddlUserCate.Items.Insert(0, new ListItem("请选择专栏", "-1"));
 }
示例#18
0
 public string GetSuperLabel(string Name, int UserId)
 {
     object obj2;
     string str = "";
     B_SuperLabel label = new B_SuperLabel();
     M_SuperLabel model = new M_SuperLabel();
     int superId = label.GetSuperId(Name);
     model = label.GetModel(superId);
     if (superId == 0)
     {
         return "该超级标签名称出错!";
     }
     if ((model.DataBaseType == 1) || (model.DataBaseType == 3))
     {
         if (model.IsHtml)
         {
             string sqlStr = model.SqlStr;
             MatchCollection matchs = Regex.Matches(sqlStr, "{#(.*?)}", RegexOptions.IgnoreCase);
             if (matchs.Count > 0)
             {
                 DataRow userAllInfo = new B_User().GetUserAllInfo(UserId);
                 foreach (Match match in matchs)
                 {
                     sqlStr = sqlStr.Replace("{#" + match.Groups[1].Value + "}", userAllInfo["" + match.Groups[1].Value + ""].ToString());
                 }
             }
             DataTable table = new DataTable();
             if (model.DataBaseType == 3)
             {
                 table = label.DataBaseTypeSql(model.DataBaseConn, model.DataBaseType.ToString(), sqlStr);
             }
             else
             {
                 table = label.CheckSql(sqlStr);
             }
             this.SqlContent = model.Content;
             this.MySqlContent = new string[3];
             this.GetStyle(this.MySqlContent);
             this.ColumnsContent = this.MySqlContent[1];
             this.MyColumnsContent = new string[3];
             this.GetStyleColumns(this.MyColumnsContent);
             int numColumns = model.NumColumns;
             int num4 = table.Rows.Count / numColumns;
             str = str + this.MySqlContent[0];
             for (int i = 0; i < table.Rows.Count; i++)
             {
                 if ((this.MySqlContent[1].Trim().ToLower().IndexOf("<ky_loop_columns>") > 0) && (this.MySqlContent[1].Trim().ToLower().IndexOf("</ky_loop_columns>") > 0))
                 {
                     str = str + this.MyColumnsContent[0];
                     int num6 = 0;
                     while (num6 < model.NumColumns)
                     {
                         if (i == table.Rows.Count)
                         {
                             str = str + this.MyColumnsContent[0] + this.MyColumnsContent[2];
                         }
                         else
                         {
                             str = str + "" + this.StrValue(table.Rows[i], model.HostTable, this.MyColumnsContent[1]) + "";
                         }
                         num6++;
                         i++;
                     }
                     str = str + this.MyColumnsContent[2];
                 }
                 else
                 {
                     str = str + "" + this.StrValue(table.Rows[i], model.HostTable, this.MySqlContent[1]) + "";
                 }
             }
             str = str + this.MySqlContent[2];
         }
         else
         {
             obj2 = str + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签开始-->";
             obj2 = string.Concat(new object[] { obj2, "<div id='SuperLabel_Div_", superId, "'></div>" });
             str = string.Concat(new object[] { obj2, "<script language=\"javascript\">var data = XmlHttpPostMethodText(\"", Param.ApplicationRootPath, "/common/SuperLabelList.aspx?SuperId=", superId, "&UserId=", UserId, "\",\"\");document.getElementById('SuperLabel_Div_", superId, "').innerHTML=data;</script>" }) + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签结束-->";
         }
     }
     if (model.DataBaseType != 2)
     {
         return str;
     }
     if (model.IsHtml)
     {
         try
         {
             WebClient client = new WebClient();
             client.Encoding = Encoding.GetEncoding("utf-8");
             byte[] bytes = client.DownloadData("" + model.SqlStr + "");
             return Encoding.GetEncoding("utf-8").GetString(bytes);
         }
         catch
         {
             return "读取外部数据错误";
         }
     }
     obj2 = str + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签开始-->";
     obj2 = string.Concat(new object[] { obj2, "<div id='SuperLabel_Div_", superId, "'></div>" });
     return (string.Concat(new object[] { obj2, "<script language=\"javascript\">var data = XmlHttpPostMethodText(\"", model.SqlStr, "\",\"\");document.getElementById('SuperLabel_Div_", superId, "').innerHTML=data;</script>" }) + "<!---" + Name.Replace("{Ky_S_", "").Replace("}", "") + "超级标签结束-->");
 }