コード例 #1
0
ファイル: SetRecommand.aspx.cs プロジェクト: suizhikuo/KYCMS
    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");
        }
    }
コード例 #2
0
ファイル: Left.aspx.cs プロジェクト: suizhikuo/KYCMS
    public string CreateChannel(string chId)
    {
        B_SiteInfo SiteBll = new B_SiteInfo();
        B_Channel ChannelBll = new B_Channel();
        M_Site SiteModel = SiteBll.GetSiteModel();
        if (!SiteModel.IsStaticType)
        {
            return "fail$全站参数设置没有开启生成静态页面功能";
        }
        string chIdStr = "";
        M_Channel channelModel = ChannelBll.GetChannel(int.Parse(chId));
        if (channelModel != null && channelModel.IsStaticType)
        {
            chIdStr = chIdStr + chId + ",";
        }

        if (chIdStr == string.Empty)
        {
            return "fail$所选频道没有开启生成静态页面功能";
        }
        chIdStr = chIdStr.Substring(0, (chIdStr.Length - 1));

        Session["createchid"] = chIdStr;
        return "succ$" + chIdStr;
    }
コード例 #3
0
ファイル: Login.aspx.cs プロジェクト: suizhikuo/KYCMS
 protected void Page_Load(object sender, EventArgs e)
 {
     B_SiteInfo bll = new B_SiteInfo();
     M_Site model = bll.GetSiteModel();
     if (model != null)
     {
         IsOpenRZM = model.IsOpenRZM;
     }
 }
コード例 #4
0
ファイル: Message.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Button1_Click(object sender, EventArgs e)
    {
        B_SiteInfo bsiteinfo = new B_SiteInfo();

        model.SendId = buser.GetCookie().UserID;
        model.SendName = buser.GetCookie().LogName;
        model.Title = bsiteinfo.GetFiltering(Title.Text);
        model.Content = bsiteinfo.GetFiltering(Function.Encode(Content.Text));
        model.IsSend = 1;
        model.ReceiverDel = 0;
        model.SendDel = 0;
        model.AddDate = DateTime.Now;
        model.OverdueDate = DateTime.Now;
        model.TypeId = 1;

        string sReceiverName = ReceiverName.Text;
        if (sReceiverName == "")
        {
            Function.ShowMsg(0, "<li>请输入用户</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
        }

        if (Title.Text.ToString() == "")
        {
            Function.ShowMsg(0, "<li>请输入标题</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
        }

        if (Content.Text.ToString() == "")
        {
            Function.ShowMsg(0, "<li>请输入内容</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
        }

        string AllUserName = "";

        for (int i = 0; i < Function.GetSplit(sReceiverName, "|").Length; i++)
        {
            muser = buser.GetUser(Function.GetSplit(sReceiverName, "|")[i]);
            if (muser != null)
            {
                if (muser.UserID != 0)
                {
                    model.ReceiverId = muser.UserID;
                    model.ReceiverName = muser.LogName;
                    model.IsRead = 0;
                    model.AllUser = 0;
                    model.UserGroupId = 0;
                    bll.Insert(model);

                    AllUserName += "[" + muser.LogName + "]";
                }
            }
        }
        if (AllUserName == "")
            Function.ShowMsg(0, "<li>没有符合条件的用户</li><li><a href='Message/MessageList.aspx?TypeId=1'>返回短消息列表</a></li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
        else
            Function.ShowMsg(1, "<li>成功给" + AllUserName + "用户发送短消息!</li><li><a href='Message/MessageList.aspx?TypeId=1'>返回短消息列表</a></li>");
    }
コード例 #5
0
ファイル: B_UpLoadPic.cs プロジェクト: suizhikuo/KYCMS
 public string LetterWaterMark(HtmlInputFile FilePicName, string FilePicPath, string UpLoadPicPath)
 {
     Font font;
     B_SiteInfo info = new B_SiteInfo();
     M_Site siteModel = new M_Site();
     siteModel = info.GetSiteModel();
     string str = "";
     if (UpLoadPicPath == "")
     {
         str = this.NotWaterMark_NotNewSize(FilePicName, FilePicPath);
     }
     else
     {
         str = UpLoadPicPath;
     }
     string waterMarkStr = siteModel.WaterMarkStr;
     int waterMarkFontSize = siteModel.WaterMarkFontSize;
     string waterMarkFontName = siteModel.WaterMarkFontName;
     string waterMarkFontColor = siteModel.WaterMarkFontColor;
     bool waterMarkIsBold = siteModel.WaterMarkIsBold;
     string path = HttpContext.Current.Server.MapPath(FilePicPath) + str;
     string[] strArray = str.Split(new char[] { '/' });
     string[] strArray2 = strArray[1].Split(new char[] { '.' });
     string destFileName = HttpContext.Current.Server.MapPath(FilePicPath) + strArray[0] + strArray2[0] + "_1" + strArray2[1];
     if (File.Exists(path))
     {
         File.Copy(path, destFileName);
     }
     Image image = Image.FromFile(destFileName);
     Graphics graphics = Graphics.FromImage(image);
     graphics.CompositingQuality = CompositingQuality.HighQuality;
     graphics.SmoothingMode = SmoothingMode.HighQuality;
     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
     graphics.DrawImage(image, 0, 0, image.Width, image.Height);
     if (waterMarkIsBold)
     {
         font = new Font(waterMarkFontName, (float) waterMarkFontSize, FontStyle.Bold);
     }
     else
     {
         font = new Font(waterMarkFontName, (float) waterMarkFontSize);
     }
     Brush brush = new SolidBrush(ColorTranslator.FromHtml("#" + waterMarkFontColor));
     string s = waterMarkStr;
     graphics.DrawString(s, font, brush, (float) 0f, (float) 0f);
     graphics.Dispose();
     image.Save(path);
     image.Dispose();
     if (File.Exists(destFileName))
     {
         File.Delete(destFileName);
     }
     return str;
 }
コード例 #6
0
ファイル: B_SendMail.cs プロジェクト: suizhikuo/KYCMS
 public void Send()
 {
     M_Site siteModel = new B_SiteInfo().GetSiteModel();
     if (siteModel != null)
     {
         string host = siteModel.EmailServerAddress.Trim();
         string userName = siteModel.EmailServerUserName.Trim();
         string password = siteModel.EmailServerUserPass.Trim();
         SmtpClient client = new SmtpClient(host);
         client.Credentials = new NetworkCredential(userName, password);
         client.Send(this.mail);
     }
 }
コード例 #7
0
ファイル: GetBackPwd.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void btnQuestion_Click(object sender, EventArgs e)
    {
        M_User model = bll.GetUser(txtUserName.Text);
        if (model != null)
        {
            if (Function.MD5Encrypt(txtAnswer.Text.Trim()) == model.Answer)
            {
                B_SiteInfo site = new B_SiteInfo();
                M_Site siteModel = site.GetSiteModel();
                //产生随机密码
                //更新数据库
                string Pwd = Function.GetRndNum(8);
                string newPwd = Function.MD5Encrypt(Pwd);
                bll.ModifyPwd(model.UserID, newPwd);

                if (siteModel != null)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(txtUserName.Text + ",您好!您在本站 (");
                    sb.Append(siteModel.SiteName + ")");
                    sb.Append("使用了找回密码功能.这是您的新密码:");
                    sb.Append(Pwd);
                    sb.Append("祝您健康愉快!");
                    sb.Append(siteModel.SiteName);
                    sb.Append(DateTime.Now);
                    try
                    {
                        B_SendMail mail = new B_SendMail(siteModel.EmailServerAddress, model.Email, txtUserName.Text + "您好!这是您的新密码", sb.ToString(), true, System.Text.Encoding.UTF8);
                        mail.Send();
                        Function.ShowMsg(1, "<li>恭喜!找回密码成功。您的新密码已经发送到您的邮箱,请注意查收!</li><li><a href='Login.aspx'>登录</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                    }
                    catch
                    {
                        Function.ShowMsg(1, "<li>恭喜!找回密码成功。这是您的新密码:"+Pwd+"</li><li><a href='Login.aspx'>登录</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                    }

                }
            }
            else
            {
                Function.ShowMsg(0, "<li>对不起,您的答案不正确!</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
            }
        }
        else
        {
            //无此用户
            Function.ShowMsg(0, "<li>无此用户</li><li><a href='Reg.aspx'>注册一个新帐户</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
        }
    }
コード例 #8
0
ファイル: Login.aspx.cs プロジェクト: suizhikuo/KYCMS
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cache.SetNoStore();
     string refer = "Main.aspx";
     B_SiteInfo siteBll = new B_SiteInfo();
     if (siteBll.GetSiteModel().IsLoginValidate)
     {
         TrValidCode.Visible = true;
         imgCode.Visible = true;
     }
     if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
     {
         refer = Request.QueryString["ReturnUrl"].ToString();
     }
     btnLogin.PostBackUrl = "DoLogin.aspx?ReturnUrl=" + Server.UrlEncode(refer);
 }
コード例 #9
0
ファイル: Left.aspx.cs プロジェクト: suizhikuo/KYCMS
 public string CreateInfoByColId(string colId)
 {
     B_SiteInfo SiteBll = new B_SiteInfo();
     B_Channel ChannelBll = new B_Channel();
     M_Site SiteModel = SiteBll.GetSiteModel();
     if (!SiteModel.IsStaticType)
     {
         return "fail$全站参数设置没有开启生成静态页面功能";
     }
     B_Column columnBll = new B_Column();
     M_Column columnModel = columnBll.GetColumn(int.Parse(colId));
     M_Channel channelModel = ChannelBll.GetChannel(columnModel.ChId);
     if (channelModel == null || !channelModel.IsStaticType)
     {
         return "fail$所属频道没有开启生成静态页面功能";
     }
     Session["newscolumnid"] = colId;
     return "succ$" + channelModel.ModelType;
 }
コード例 #10
0
ファイル: B_UpLoadPic.cs プロジェクト: suizhikuo/KYCMS
 public string GetUpLoadPicPath(HtmlInputFile FilePicName, string FilePicPath, bool WaterMark, bool NewSize, int MaxWidth, int MaxHeight, bool BiLi, int BiLiValue, int FileSize)
 {
     string fileName = Path.GetFileName(FilePicName.PostedFile.FileName);
     string str2 = Path.GetExtension(FilePicName.PostedFile.FileName).ToString();
     bool flag = false;
     if ((FileSize != 0) && (FilePicName.PostedFile.ContentLength > (FileSize * 0x400)))
     {
         HttpContext.Current.Response.Write("<script>alert('上传图片大小超出了限制');window.close();</script>");
         HttpContext.Current.Response.End();
     }
     B_SiteInfo info = new B_SiteInfo();
     string imgUploadType = info.GetInfoModel().ImgUploadType;
     string[] strArray = imgUploadType.Split(new char[] { '|' });
     for (int i = 0; i < strArray.Length; i++)
     {
         if (strArray[i].ToLower() == str2.ToLower())
         {
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         HttpContext.Current.Response.Write("<script>alert('上传图片格式只能够是:" + imgUploadType + "!');window.close();</script>");
         HttpContext.Current.Response.End();
     }
     M_Site siteModel = new M_Site();
     siteModel = info.GetSiteModel();
     if (NewSize)
     {
         return this.PicNewSize(FilePicName, FilePicPath, WaterMark, MaxWidth, MaxHeight, BiLi, BiLiValue);
     }
     if (WaterMark)
     {
         if (siteModel.IsImgWaterMark)
         {
             return this.PicWaterMark(FilePicName, FilePicPath, "");
         }
         return this.LetterWaterMark(FilePicName, FilePicPath, "");
     }
     return this.NotWaterMark_NotNewSize(FilePicName, FilePicPath);
 }
コード例 #11
0
ファイル: SetUserCate.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Page_Load(object sender, EventArgs e)
    {
        userBll.CheckIsLogin();
        userInfo = userBll.GetCookie();
        M_Site siteModel = null;
        B_SiteInfo siteBll = new B_SiteInfo();
        siteModel = siteBll.GetSiteModel();
        int count = userBll.GetUserCateCount(userInfo.UserID);
        if (!string.IsNullOrEmpty(Request["UCId"]))
        {
            try
            {
                UCId = int.Parse(Request["UCId"]);
            }
            catch { }
        }
        if (count >= siteModel.UserClassCount && siteModel.UserClassCount != 0 && UCId <= 0)
        {
            Function.ShowMsg(0, "<li>您创建的专栏数已达到上限,请联系系统管理员</li><li><a href='javascript:history.back()'>返回上一级</a></li>");
            return;
        }
        if (!IsPostBack)
        {

            if (UCId > 0)
            {
                ShowInfo();
            }
            lbUserName.Text = userInfo.LogName;
            ltMsg.Text = "";

            DataTable dt = InfoModelBll.GetList();
            ddlCateType.DataTextField = "ModelName";
            ddlCateType.DataValueField = "ModelId";
            ddlCateType.DataSource = dt.DefaultView;
            ddlCateType.DataBind();
            dt.Dispose();
        }
    }
コード例 #12
0
ファイル: Feedback.aspx.cs プロジェクト: suizhikuo/KYCMS
 protected void btnOk_Click(object sender, EventArgs e)
 {
     if (FId != 0)
     {
         if (txtReply.Text.Trim() == "")
         {
             Function.ShowMsg(0, "<li>回复内容不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
         }
         M_Feedback model = new M_Feedback();
         B_SiteInfo siteBll = new B_SiteInfo();
         model.Content = siteBll.GetFiltering(txtReply.Text);
         model.ParentId = FId;
         model.EndDate = model.ReplyDate = DateTime.Now;
         model.Ip = Request.UserHostAddress;
         model.Author = user.GetCookie().LogName;
         model.Title = "";
         model.CategoryId = Convert.ToInt32(feedback.GetFeedback(FId).Tables[0].Rows[0]["CategoryId"]);
         model.State = 0;
         feedback.Add(model);
         txtReply.Text = "";
         Response.Redirect("MyFeedback.aspx");
     }
 }
コード例 #13
0
ファイル: B_SoftUpLoad.cs プロジェクト: suizhikuo/KYCMS
 public string UpLoadSoft(HtmlInputFile FilePicName, string FilePicPath)
 {
     string fileName = Path.GetFileName(FilePicName.PostedFile.FileName);
     string str2 = Path.GetExtension(FilePicName.PostedFile.FileName).ToString();
     bool flag = false;
     B_SiteInfo info = new B_SiteInfo();
     string softUploadType = info.GetInfoModel().SoftUploadType;
     string[] strArray = softUploadType.Split(new char[] { '|' });
     for (int i = 0; i < strArray.Length; i++)
     {
         if (strArray[i].ToLower() == str2.ToLower())
         {
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         HttpContext.Current.Response.Write("<script>alert('上传软件格式只能够是:" + softUploadType + "');window.history.go(-1);</script>");
         HttpContext.Current.Response.End();
     }
     if ((((FilePicName.PostedFile.ContentType == "text/asp") || (FilePicName.PostedFile.ContentType == "video/x-ms-asf")) || ((FilePicName.PostedFile.ContentType == "text/html") || (FilePicName.PostedFile.ContentType == "application/xml"))) || (FilePicName.PostedFile.ContentType == "text/plain"))
     {
         HttpContext.Current.Response.Write("<script>alert('上传文件格式不正确,请压缩后再上传');window.history.go(-1);</script>");
         HttpContext.Current.Response.End();
     }
     string str4 = Function.GetFileName();
     string str5 = DateTime.Now.ToString("yyyyMM");
     string path = HttpContext.Current.Server.MapPath(FilePicPath) + str5 + "/";
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     string filename = path + str4 + str2;
     FilePicName.PostedFile.SaveAs(filename);
     return ("/" + str5 + "/" + str4 + str2);
 }
コード例 #14
0
ファイル: AddFeedback.aspx.cs プロジェクト: suizhikuo/KYCMS
 protected void btnOk_Click(object sender, EventArgs e)
 {
     if (userModel != null)
     {
         if (txtTitle.Text.Trim() == "")
         {
             Function.ShowMsg(0, "<li>对不起,请输入问答标题</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
         }
         if (lsbCategory.SelectedValue == "")
         {
             Function.ShowMsg(0, "<li>对不起,请选择分类</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
         }
         M_Feedback model = new M_Feedback();
         int rewardNum = int.Parse(ddlReward.SelectedValue);
         if (userModel.Integral >= rewardNum)
         {
             model.Reward = rewardNum;
         }
         else
         { Function.ShowMsg(0, "<li>您的积分不够,不能设置为 "+rewardNum+" 的悬赏分</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); }
         model.ParentId = 0;
         model.ReplyDate = DateTime.Now;
         model.State = 0;
         model.Title = txtTitle.Text;
         model.Author = userModel.LogName;
         B_SiteInfo siteBll = new B_SiteInfo();
         model.Content = siteBll.GetFiltering(txtContent.Text);
         model.Ip = Request.UserHostAddress;
         model.EndDate = DateTime.Now.AddDays(14);
         model.CategoryId = int.Parse(lsbCategory.SelectedValue);
         feedback.Add(model);
         rewardNum = rewardNum * -1;
         moneyBll.Integral(rewardNum, userModel.LogName);
         Response.Redirect("MyFeedback.aspx");
     }
 }
コード例 #15
0
ファイル: Createing.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void CreateInfo(int modelIdNum)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelIdNum);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                          //取得模型的表名
        string modelName = infoModelM.ModelName;

        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;

        int pageIndex = 1;                                                                                                //初始化页的索引号
        int recordCount = 0;                                                                                              //统计要生成新闻的条数
        int pageTotl = 0;                                                                                                 //统计总页数

        B_Create createBll = new B_Create();
        createBll.InfoRecordCount(tableName, "", ref recordCount);

        pageTotl = (recordCount - 1) / pageSize + 1;
        Response.Write("<script>SetTotal(" + recordCount + ")</script>\r\n");
         Response.Flush();
        string currentPer = "0.0";
        for (int crti = 1; crti <= pageTotl; crti++)
        {
            pageIndex = crti;

            DataTable dt = createBll.GetInfo(tableName, pageIndex, pageSize);
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                int currIndex = pageSize * (crti - 1) + i;
                string per = ((double)currIndex * 100 / (double)recordCount).ToString("F1");
                CreateBll.CreateInfo(dt.Rows[i - 1]);
                if (currentPer != per)
                {
                    currentPer = per;
                    Response.Write("<script>SetPr('" + per + "%'," + currIndex + ")</script>\r\n");
                    Response.Flush();
                }
            }
            dt.Dispose();
        }

        Response.Write("<script>SetPr('100.0%'," + recordCount + ")</script>");
        Response.Write("<script>document.getElementById('finallytd').innerText = '生成完毕'</script>");
        Response.Flush();
        CreateBll.ClearHashTable();
    }
コード例 #16
0
ファイル: SetMessage.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Set(bool isSet)
    {
        B_SiteInfo bsiteinfo = new B_SiteInfo();
        model.SendId = buser.GetCookie().UserID;
        model.SendName = buser.GetCookie().LogName;
        model.Title = bsiteinfo.GetFiltering(Title.Text);
        model.Content = bsiteinfo.GetFiltering(Function.Encode(Content.Text));
        if (isSet)
            model.IsSend = 1;
        else
            model.IsSend = 0;
        model.ReceiverDel = 0;
        model.SendDel = 0;
        model.AddDate = DateTime.Now;
        model.OverdueDate = DateTime.Now;
        model.TypeId = 1;

        string sReceiverName = ReceiverName.Text;
        if (sReceiverName == "")
        {
            lbMsg.Text = "<script>alert('请输入收件人')</script>";
            return;
        }
        if (Title.Text.ToString() == "")
        {
            lbMsg.Text = "<script>alert('请输入标题')</script>";
            return;
        }

        if (Content.Text.ToString() == "")
        {
            lbMsg.Text = "<script>alert('请输入内容')</script>";
            return;
        }

        string AllUserName = "";

        muser = buser.GetUser(sReceiverName);
        if (muser != null)
        {
            if (muser.UserID != 0)
            {
                model.ReceiverId = muser.UserID;
                model.ReceiverName = muser.LogName;
                model.IsRead = 0;
                model.AllUser = 0;
                model.UserGroupId = 0;
                bll.Insert(model);
                AllUserName = muser.LogName;
            }
        }
        if (AllUserName == "")
        {
            lbMsg.Text = "<script>alert('没有符合条件的用户')</script>";
            return;
        }
        else
        {
            if (isSet)
            {
                lbMsg.Text = "<script>alert('成功给用户" + AllUserName + "发送短消息');hiddenIframe();</script>";
                return;
            }
            else
            {
                lbMsg.Text = "<script>alert('成功保存草稿');hiddenIframe()</script>";
                return;
            }
        }
    }
コード例 #17
0
ファイル: B_UpLoadPic.cs プロジェクト: suizhikuo/KYCMS
 public string PicNewSize(HtmlInputFile FilePicName, string FilePicPath, bool WaterMark, int MaxWidth, int MaxHeight, bool BiLi, int BiLiValue)
 {
     Size size;
     string upLoadPicPath = this.NotWaterMark_NotNewSize(FilePicName, FilePicPath);
     string path = HttpContext.Current.Server.MapPath(FilePicPath) + upLoadPicPath;
     string[] strArray = upLoadPicPath.Split(new char[] { '/' });
     string[] strArray2 = strArray[1].Split(new char[] { '.' });
     string destFileName = HttpContext.Current.Server.MapPath(FilePicPath) + strArray[0] + strArray2[0] + "_1" + strArray2[1];
     if (File.Exists(path))
     {
         File.Copy(path, destFileName);
     }
     Image image = Image.FromFile(destFileName);
     if (BiLi)
     {
         size = NewSize((image.Width * BiLiValue) / 100, (image.Height * BiLiValue) / 100, image.Width, image.Height);
     }
     else
     {
         size = NewSize(MaxWidth, MaxHeight, image.Width, image.Height);
     }
     Bitmap bitmap = new Bitmap(size.Width, size.Height);
     Graphics graphics = Graphics.FromImage(bitmap);
     graphics.CompositingQuality = CompositingQuality.HighQuality;
     graphics.SmoothingMode = SmoothingMode.HighQuality;
     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
     graphics.DrawImage(image, new Rectangle(0, 0, size.Width, size.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);
     graphics.Dispose();
     bitmap.Save(path);
     bitmap.Dispose();
     image.Dispose();
     if (File.Exists(destFileName))
     {
         File.Delete(destFileName);
     }
     B_SiteInfo info = new B_SiteInfo();
     M_Site siteModel = new M_Site();
     siteModel = info.GetSiteModel();
     if (!WaterMark)
     {
         return upLoadPicPath;
     }
     if (siteModel.IsImgWaterMark)
     {
         return this.PicWaterMark(FilePicName, FilePicPath, upLoadPicPath);
     }
     return this.LetterWaterMark(FilePicName, FilePicPath, upLoadPicPath);
 }
コード例 #18
0
ファイル: B_Tag.cs プロジェクト: suizhikuo/KYCMS
 public DataRow AddTagStr(string tagNameStr, int modelType, int uId, string uName)
 {
     tagNameStr = new B_SiteInfo().GetFiltering(tagNameStr);
     return this.dal.AddTagStr(tagNameStr, modelType, uId, uName);
 }
コード例 #19
0
ファイル: B_Admin.cs プロジェクト: suizhikuo/KYCMS
 public void SetLoginState(M_Admin model)
 {
     bool allowMultiLogin = model.AllowMultiLogin;
     M_Site siteModel = new B_SiteInfo().GetSiteModel();
     string rndNum = Ky.Common.Function.GetRndNum(16);
     HttpContext.Current.Response.Cookies["AdminState"]["UserId"] = model.UserId.ToString();
     HttpContext.Current.Response.Cookies["AdminState"]["LoginName"] = Ky.Common.Function.UrlEncode(model.LoginName);
     HttpContext.Current.Response.Cookies["AdminState"]["AdminName"] = Ky.Common.Function.UrlEncode(model.UserName);
     HttpContext.Current.Response.Cookies["AdminState"]["Password"] = Ky.Common.Function.DESEncrypt(model.Password);
     if (HttpContext.Current.Request.UserHostAddress != null)
     {
         model.LastLoginIP = HttpContext.Current.Request.UserHostAddress;
     }
     else
     {
         model.LastLoginIP = "";
     }
     model.LastLoginTime = DateTime.Now;
     model.RandNumber = rndNum;
     this.UpdateState(model);
     HttpContext.Current.Response.Cookies["randNum"].Value = rndNum;
     B_Log.Add(LogType.Login, "登陆后台");
     HttpContext.Current.Response.Redirect(Param.ApplicationRootPath + "/System/Index.aspx");
 }
コード例 #20
0
ファイル: DoLogin.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Page_Load(object sender, EventArgs e)
    {
        IndexUrl = CreateBll.GetIndexUrl();
        string logName = "";
        string pwd = "";
        string cookieType = "";
        string valideCode = "";
        if (Request.Form["txtUserName"] != null && Request.Form["txtPwd"] != null && Request.Form["rbCookie"] != null)
        {
            logName = Function.UrlDecode(Request.Form["txtUserName"].ToString());
            //pwd = Function.MD5Encrypt(Request.Form["txtPwd"].ToString());
            pwd = Request.Form["txtPwd"];
            cookieType = Request.Form["rbCookie"].ToString();
        }
        if (siteBll.GetSiteModel().IsLoginValidate)
        {
            if (Request.Form["txtValidateCode"] == null)
            {
                Function.ShowMsg(0, "<li>请输入验证码</li><li><a href='login.aspx'>重新登录</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
            }
            else
            {
                valideCode = Request.Form["txtValidateCode"].ToString().ToLower();
            }
            if (valideCode != Session["ValidateCode"].ToString())
            {
                Function.ShowMsg(0, "<li>对不起,输入的验证码错误.请重新输入</li><li><a href='login.aspx'>重新登录</a></li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
            }
        }

        if ((!string.IsNullOrEmpty(logName)) && (!string.IsNullOrEmpty(pwd)))
        {
            B_SiteInfo siteInfo = new B_SiteInfo();
            M_Site siteModel = siteInfo.GetSiteModel();
            M_User model = userBll.GetUser(logName);
            if (model != null && siteModel != null)
            {
                //用户被锁定
                if (model.IsLock == true)
                {
                    Function.ShowMsg(0, "<li>对不起,您已经被锁定,不能登录.</li><li>如果您是新注册用户,您可能需要先激活帐号</li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                }
                if (model.Status == 0)
                {
                    Function.ShowMsg(0, "<li>对不起,您还未通过管理员认证,不能登录.</li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                }
                //用户还在禁止登录时间内
                if (model.ErrorTime > DateTime.Now)
                {
                    Function.ShowMsg(0, "<li>对不起,您已经登录错误 " + siteModel.LogErrorNum + " 次,将被禁止登录 " + siteModel.DisabledLoginTime + " 分钟.</li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                }
                else
                {
                    //用户登录
                    bool flag = userBll.Login(logName, pwd);
                    if (flag && (!string.IsNullOrEmpty(cookieType)))
                    {
                        HttpCookie cookie = new HttpCookie("User");
                        cookie["uId"] = model.UserID.ToString();
                        cookie["logN"] = Function.UrlEncode(model.LogName);
                        cookie["pd"] = model.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;
                        }
                        cookie.Domain = WebConfigurationManager.AppSettings["KYCMS_CookieDomain"];
                        Response.Cookies.Add(cookie);
                        string bbsCookieValue = bbsUserBll.GetUserCookie(Request.Form["txtUserName"],Request.Form["txtPwd"]);
                        bbsUserBll.WriteUserCookie(bbsCookieValue);
                        lbUserName.Text = logName;
                        if (Request.UrlReferrer != null)
                        {
                            ReferUrl = Request.UrlReferrer.ToString();
                        }
                        if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
                        {
                            ReferUrl = Request.QueryString["ReturnUrl"].ToString();
                        }

                        //设置自动转向
                        HtmlMeta meta = new HtmlMeta();
                        meta.HttpEquiv = "Refresh";
                        meta.Content = "3;url=" + Server.UrlDecode(ReferUrl);
                        Header.Controls.Add(meta);
                        hyMain.NavigateUrl = "Main.aspx";
                        hyRefer.NavigateUrl = ReferUrl;
                        hyRefer.Text = ReferUrl;
                        hyIndex.NavigateUrl = IndexUrl;

                        //更新登录信息
                        string lastLoginIP = string.Empty;
                        if(Request.UserHostAddress!=null)
                        {
                            lastLoginIP = Request.UserHostAddress;
                        }
                        DateTime currLoginTime = DateTime.Now;
                        DateTime oldLoginTime = model.LastLoginTime;
                        userBll.LoginSuccess(model.UserID, lastLoginIP, currLoginTime);
                        if (oldLoginTime.Date != currLoginTime.Date)
                        {
                            B_Money moneyBll = new B_Money();
                            moneyBll.Integral(siteModel.LoginScore, model.UserID);
                        }
                    }

                    //登录失败
                    //检查错误次数,如果达到设定次数,
                    //则更新禁止登录时间
                    else
                    {
                        //修改时间
                        if (model.ErrorNum >= (siteModel.LogErrorNum - 1))
                        {
                            DateTime errorTime = DateTime.Now.AddMinutes(siteModel.DisabledLoginTime);
                            userBll.LoginFailOnErrorNum(model.UserID, errorTime);
                            Function.ShowMsg(0, "<li>对不起,您已经登录错误 " + siteModel.LogErrorNum + " 次,将被禁止登录 " + siteModel.DisabledLoginTime + " 分钟.</li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                        }
                        // 修改次数
                        else
                        {
                            userBll.LoginFailError(model.UserID);
                            Function.ShowMsg(0, "<li>对不起,登录失败!请检查您的用户名和密码.</li><li><a href='Login.aspx'>重新登录</a>(您还有" + (siteModel.LogErrorNum - model.ErrorNum) + "次机会)</li><li><a href='" + IndexUrl + "'>返回网站首页</a></li>");
                        }
                    }
                }
            }

            //用户不存在
            else
            {
                Function.ShowMsg(0,"<li>对不起,此用户不存在</li><li><a href='Reg.aspx'>注册新用户</a></li><li><a href='Login.aspx'>重新登录</a></li>");
            }
        }

        //post过来的数据不合法
        else
        {
            Response.Redirect("Login.aspx");
        }
    }
コード例 #21
0
ファイル: Createing.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void CreateLastInfoRecord(int modelId)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelId);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                                        //取得模型的表名

        int newRecord = int.Parse(Request.QueryString["newsrecordcount"].ToString());
        B_Create CreateBll = new B_Create();

        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;
        int pageIndex = 1;
        int recordCount = CreateBll.LastInfoCount(tableName, newRecord);
        int pageTotl = 0;

        pageTotl = (recordCount - 1) / pageSize + 1;
        Response.Write("<script>SetTotal(" + recordCount + ")</script>\r\n");
        Response.Flush();
        string currentPer = "0.0";
        for (int crti = 1; crti <= pageTotl; crti++)
        {
            pageIndex = crti;
            DataTable dt = CreateBll.GetNewRecordNum(tableName, newRecord, pageIndex, pageSize);
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                int currIndex = pageSize * (crti - 1) + i;
                string per = ((double)currIndex * 100 / (double)recordCount).ToString("F1");
                CreateBll.CreateInfo(dt.Rows[i - 1]);
                if (currentPer != per)
                {
                    currentPer = per;
                    Response.Write("<script>SetPr('" + per + "%'," + currIndex + ")</script>\r\n");
                    Response.Flush();
                }
            }
            dt.Dispose();
        }

        Response.Write("<script>SetPr('100.0%'," + recordCount + ")</script>");
        Response.Write("<script>document.getElementById('finallytd').innerText = '生成完毕'</script>");
        Response.Flush();
        CreateBll.ClearHashTable();
    }
コード例 #22
0
ファイル: B_UpLoadPic.cs プロジェクト: suizhikuo/KYCMS
        public string PicWaterMark(HtmlInputFile FilePicName, string FilePicPath, string UpLoadPicPath)
        {
            B_SiteInfo info = new B_SiteInfo();
            M_Site siteModel = new M_Site();
            siteModel = info.GetSiteModel();
            string[] strArray = siteModel.WaterMarkHW.Split(new char[] { '|' });
            string path = Param.ApplicationRootPath + siteModel.WaterMarkPath;
            int srcHeight = int.Parse(strArray[0]);
            int srcWidth = int.Parse(strArray[1]);
            int waterMarkLight = siteModel.WaterMarkLight;
            int waterMarkPos = siteModel.WaterMarkPos;
            string str2 = "";
            if (UpLoadPicPath == "")
            {
                str2 = this.NotWaterMark_NotNewSize(FilePicName, FilePicPath);
            }
            else
            {
                str2 = UpLoadPicPath;
            }
            string str3 = HttpContext.Current.Server.MapPath(FilePicPath) + str2;
            string[] strArray2 = str2.Split(new char[] { '/' });
            string[] strArray3 = strArray2[1].Split(new char[] { '.' });
            string destFileName = HttpContext.Current.Server.MapPath(FilePicPath) + strArray2[0] + strArray3[0] + "_1" + strArray3[1];
            if (File.Exists(str3))
            {
                File.Copy(str3, destFileName);
            }
            Image image = Image.FromFile(destFileName);
            Image image2 = Image.FromFile(HttpContext.Current.Server.MapPath(path));
            float[][] numArray = new float[5][];
            float[] numArray2 = new float[5];
            numArray2[0] = 1f;
            numArray[0] = numArray2;
            float[] numArray3 = new float[5];
            numArray3[1] = 1f;
            numArray[1] = numArray3;
            float[] numArray4 = new float[5];
            numArray4[2] = 1f;
            numArray[2] = numArray4;
            float[] numArray5 = new float[5];
            numArray5[3] = ((float) waterMarkLight) / 100f;
            numArray[3] = numArray5;
            float[] numArray6 = new float[5];
            numArray6[4] = 1f;
            numArray[4] = numArray6;
            float[][] newColorMatrix = numArray;
            ColorMatrix matrix = new ColorMatrix(newColorMatrix);
            ImageAttributes imageAttr = new ImageAttributes();
            imageAttr.SetColorMatrix(matrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            Graphics graphics = Graphics.FromImage(image);
            switch (waterMarkPos)
            {
                case 1:
                    graphics.DrawImage(image2, new Rectangle(0, 0, srcWidth, srcHeight), 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, imageAttr);
                    break;

                case 2:
                    graphics.DrawImage(image2, new Rectangle(image.Width - srcWidth, 0, srcWidth, srcHeight), 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, imageAttr);
                    break;

                case 3:
                    graphics.DrawImage(image2, new Rectangle(image.Width - srcWidth, image.Height - srcHeight, srcWidth, srcHeight), 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, imageAttr);
                    break;

                case 4:
                    graphics.DrawImage(image2, new Rectangle(0, image.Height - srcHeight, srcWidth, srcHeight), 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel, imageAttr);
                    break;
            }
            graphics.Dispose();
            image.Save(str3);
            image.Dispose();
            if (File.Exists(destFileName))
            {
                File.Delete(destFileName);
            }
            return str2;
        }
コード例 #23
0
ファイル: Createing.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void CreateInfoColumn(int modelId)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelId);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;

        B_Create CreateBll = new B_Create();

        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;
        int pageIndex = 1;
        int recordCount = 0;
        int pageTotl = 0;

        string infoColId = Session["newscolumnid"].ToString();
        string wheStr = " and i.colid in(" + infoColId + ")";
        CreateBll.InfoRecordCount(tableName, wheStr,ref recordCount);

        pageTotl = (recordCount - 1) / pageSize + 1;
        Response.Write("<script>SetTotal(" + recordCount + ")</script>\r\n");
        Response.Flush();
        string currentPer = "0.0";
        for (int crti = 1; crti <= pageTotl; crti++)
        {
            pageIndex = crti;
            DataTable dt = CreateBll.GetColumnAll(tableName, infoColId,pageIndex, pageSize);
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                int currIndex = pageSize * (crti - 1) + i;
                string per = ((double)currIndex * 100 / (double)recordCount).ToString("F1");
                CreateBll.CreateInfo(dt.Rows[i - 1]);
                if (currentPer != per)
                {
                    currentPer = per;
                    Response.Write("<script>SetPr('" + per + "%'," + currIndex + ")</script>\r\n");
                    Response.Flush();
                }
            }
            dt.Dispose();
        }

        Response.Write("<script>SetPr('100.0%'," + recordCount + ")</script>");
        Response.Write("<script>document.getElementById('finallytd').innerText = '生成完毕'</script>");
        Response.Flush();
        CreateBll.ClearHashTable();
    }
コード例 #24
0
ファイル: AddReview.aspx.cs プロジェクト: suizhikuo/KYCMS
    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>";
                }
            }
        }
    }
コード例 #25
0
ファイル: Createing.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void CreateInfoId(int modelIdNum)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelIdNum);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                                        //取得模型的表名

        int startId = int.Parse(Request.QueryString["startid"].ToString());
        int endId = int.Parse(Request.QueryString["endid"].ToString());
        B_Create CreateBll = new B_Create();
        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;
        int pageIndex = 1;
        int recordCount = 0;
        int pageTotl = 0;

        string wheStr = " and i.id in(select id from " + tableName + " where id>=" + startId + " and id<=" + endId + ") ";

        CreateBll.InfoRecordCount(tableName, wheStr, ref recordCount);

        pageTotl = (recordCount - 1) / pageSize + 1;
        Response.Write("<script>SetTotal(" + recordCount + ")</script>\r\n");
        Response.Flush();
        string currentPer = "0.0";
        for (int crti = 1; crti <= pageTotl; crti++)
        {
            pageIndex = crti;

            DataTable dt = CreateBll.GetIdRange(tableName, startId, endId, pageIndex, pageSize);
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                int currIndex = pageSize * (crti - 1) + i;
                string per = ((double)currIndex * 100 / (double)recordCount).ToString("F1");
                CreateBll.CreateInfo(dt.Rows[i - 1]);
                if (currentPer != per)
                {
                    currentPer = per;
                    Response.Write("<script>SetPr('" + per + "%'," + currIndex + ")</script>\r\n");
                    Response.Flush();
                }
            }
            dt.Dispose();
        }

        Response.Write("<script>SetPr('100.0%'," + recordCount + ")</script>");
        Response.Write("<script>document.getElementById('finallytd').innerText = '生成完毕'</script>");
        Response.Flush();
        CreateBll.ClearHashTable();
    }
コード例 #26
0
ファイル: UserLogin.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string valideCode = "";
        lbMsg.Text = "";
        if (Request.Form["txtUserName"] != null && Request.Form["txtPwd"] != null)
        {
            logName = Function.UrlDecode(Request.Form["txtUserName"].ToString());
            pwd = Function.MD5Encrypt(Request.Form["txtPwd"].ToString());
        }
        if (siteBll.GetSiteModel().IsLoginValidate)
        {
            if (Request.Form["txtValidateCode"] == null)
            {
                lbMsg.Text = "<script>alert('请输入验证码')</script>";
                return;
            }
            else
            {
                valideCode = Request.Form["txtValidateCode"].ToString().ToLower();
            }
            if (Session["ValidateCode"] != null)
            {
                if (valideCode != Session["ValidateCode"].ToString())
                {
                    lbMsg.Text = "<script>alert('对不起,输入的验证码错误.请重新输入');</script>";
                    imgCode.ImageUrl = "~/common/Code.aspx";
                }
            }
            else
            {
                lbMsg.Text = "<script>alert('对不起,您在本页停留时间太长,请退出');hiddenIframe();</script>";
            }
        }
        B_SiteInfo siteInfo = new B_SiteInfo();
        M_Site siteModel = siteInfo.GetSiteModel();
        M_User model = userBll.GetUser(logName);
        if (model != null && siteModel != null)
        {
            //用户被锁定
            if (model.IsLock == true)
            {
                lbMsg.Text = "<script>alert('对不起,您已经被锁定,不能登录.')</script>";
                return;
            }
            //用户还在禁止登录时间内
            if (model.ErrorTime > DateTime.Now)
            {
                lbMsg.Text = "<script>alert('对不起,您已经登录错误 " + siteModel.LogErrorNum + " 次,将被禁止登录 " + siteModel.DisabledLoginTime + " 分钟.')</script>";
                return;
            }
            else
            {
                //用户登录
                bool flag = userBll.Login(logName, pwd);
                if (flag)
                {
                    HttpCookie cookie = new HttpCookie("User");
                    cookie["uId"] = model.UserID.ToString();
                    cookie["logN"] = model.LogName;
                    cookie["pd"] = model.UserPwd;
                    //cookie过期时间20分钟
                    cookie.Expires = DateTime.Now.AddMinutes(20);
                    Response.Cookies.Add(cookie);

                    //更新登录信息
                    string lastLoginIP = string.Empty;
                    if (Request.UserHostAddress != null)
                    {
                        lastLoginIP = Request.UserHostAddress;
                    }
                    DateTime currLoginTime = DateTime.Now;
                    DateTime oldLoginTime = model.LastLoginTime;
                    userBll.LoginSuccess(model.UserID, lastLoginIP, currLoginTime);
                    if (currLoginTime.Date != oldLoginTime.Date)
                    {
                        B_Money moneyBll = new B_Money();
                        moneyBll.Integral(siteModel.LoginScore, model.UserID);
                    }
                    //lbMsg.Text = "<script>hiddenIframe();parent.divLoginInfo.innerHTML=\"" + userBll.GetCookie().LogName + " 您好!┆<a href='../user/main.aspx' target='_blank' target='_blank'>发表文章</a>┆<a href='SignOut.aspx'>安全退出</a>\";</script>";
                    lbMsg.Text = "<script>hiddenIframe();parent.location.reload()</script>";
                }

                //登录失败
                //检查错误次数,如果达到设定次数,
                //则更新禁止登录时间
                else
                {
                    //修改时间
                    if (model.ErrorNum >= (siteModel.LogErrorNum - 1))
                    {
                        DateTime errorTime = DateTime.Now.AddMinutes(siteModel.DisabledLoginTime);
                        userBll.LoginFailOnErrorNum(model.UserID, errorTime);
                        lbMsg.Text = "<script>alert('对不起,您已经登录错误 " + siteModel.LogErrorNum + " 次,将被禁止登录 " + siteModel.DisabledLoginTime + " 分钟.')</script>";
                        return;
                    }
                    // 修改次数
                    else
                    {
                        userBll.LoginFailError(model.UserID);
                        lbMsg.Text = "<script>alert('对不起,登录失败!请检查您的用户名和密码.')</script>";
                        return;
                    }
                }
            }
        }

        //用户不存在
        else
        {
            lbMsg.Text = "<script>alert('对不起,此用户不存在')</script>";
            return;
        }
    }
コード例 #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        if (!string.IsNullOrEmpty(Request.QueryString["ColorId"]))
        {
            ColorId = Convert.ToInt32(Request.QueryString["ColorId"]);
        }
        if (!string.IsNullOrEmpty(Request.QueryString["UserName"]))
        {
            UserName = Request.QueryString["UserName"];
        }

        UserModel = UserBll.GetUser(UserName);
        if (UserModel == null)
        {
            Function.ShowMsg(0, "<li>用户空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
        }
        UserInfoDr = UserBll.GetUserAllInfo(UserModel.UserID);
        if(UserInfoDr==null)
        {
            Function.ShowMsg(0, "<li>用户空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
        }
        int spaceTypeId = int.Parse(UserInfoDr["spacetypeid"].ToString());
        if (spaceTypeId != 1)
            Function.ShowMsg(0, "<li>用户空间参数错误</li><li><a href='javascript:history.back();'>返回上一级</a></li>");
        B_UserSpace.IsActive(UserModel.UserID, 2);
        UserGroupModel = UserGroupBll.GetModel(UserModel.GroupID);
        GroupName = UserGroupModel.UserGroupName;
        if (Request.Cookies["SpacePwd"] != null)
        {
            if (Request.Cookies["SpacePwd"]["UserId"] != UserModel.UserID.ToString())
            {
                Response.Cookies["SpacePwd"].Expires = DateTime.Now.AddDays(-1);
            }
        }
        SpaceModel = SpaceBll.GetUserSpaceById(UserModel.UserID);
        if (SpaceModel.TemplateId >= 18 && SpaceModel.TemplateId <= 24)
            StyleCss = "<link rel='stylesheet' type='text/css' href='skin/Space" + SpaceModel.TemplateId + ".css' />";
        else
            StyleCss = "<link rel='stylesheet' type='text/css' href='skin/Space18.css' />";
        SpaceName = SpaceModel.SpaceName;
        if (!IsPostBack)
        {
            SpacePrevPower();
            B_SiteInfo siteInfo = new B_SiteInfo();
            M_Site siteModel = siteInfo.GetSiteModel();
            lbCopyRight.Text = siteModel.CopyRight;
            repMyInfoBind();
            repMessageBind();
            repFriendBind();
            repAlbum();

        }

        AjaxPro.Utility.RegisterTypeForAjax(typeof(userspace_SpaceTemplate));
    }
コード例 #28
0
ファイル: WebMessage.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void Button1_Click(object sender, EventArgs e)
    {
        B_SiteInfo bsiteinfo = new B_SiteInfo();

        string sSelectUserType = Request.Form["SelectUserType"];
        string sTitle = bsiteinfo.GetFiltering(Title.Text);
        string sContent = bsiteinfo.GetFiltering(Function.Encode(Content.Text));
        B_Admin adminBll = new B_Admin();
        M_LoginAdmin loginModel = adminBll.GetLoginModel();
        string sSendName = loginModel.AdminName.ToString();
        string sOverdueDate = OverdueDate.Text;

        model.SendId = 0;
        model.SendName = sSendName;
        model.Title = sTitle;
        model.Content = sContent;
        model.IsSend = 1;
        model.ReceiverDel = 0;
        model.SendDel = 0;
        model.OverdueDate = DateTime.Parse(sOverdueDate);
        model.AddDate = DateTime.Now;
        model.TypeId = 1;

        //所有用户
        if (sSelectUserType == "1")
        {
            model.ReceiverId = 0;
            model.ReceiverName = "";
            model.IsRead = 1;
            model.AllUser = 1;
            model.UserGroupId = 0;
            bll.Insert(model);

            Function.ShowSysMsg(1, "<li>成功向所有用户发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>");
        }

        //指定用户组
        if (sSelectUserType == "2")
        {
            model.ReceiverId = 0;
            model.ReceiverName = "";
            model.IsRead = 1;
            model.AllUser = 0;

            string MyUserGroupList = "";

            if (UserGroupList.Items.Count > 0)
            {
                for (int i = 0; i < UserGroupList.Items.Count; i++)
                {
                    if (UserGroupList.Items[i].Selected == true)
                    {
                        MyUserGroupList += UserGroupList.Items[i].Text+"、";
                        model.UserGroupId = int.Parse(UserGroupList.Items[i].Value.ToString());
                        bll.Insert(model);
                    }
                }
            }

            Function.ShowSysMsg(1, "<li>成功向" + MyUserGroupList.Substring(0, MyUserGroupList.Length - 1) + "组发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>");
        }

        //指定用户
        if (sSelectUserType == "3")
        {
            string sUserNmuber = UserNmuber.Text;
            if (sUserNmuber == "")
            {
                Function.ShowSysMsg(0, "<li>请输入用户</li><li><a href='javascript:window.history.back(-1)'>返回上一步</a></li>");
            }

            string MyUserNumber = "";

            for (int i = 0; i < Function.GetSplit(sUserNmuber, "|").Length; i++)
            {
                muser = buser.GetUser(Function.GetSplit(sUserNmuber, "|")[i]);

                if (muser!=null)
                {
                    MyUserNumber += Function.GetSplit(sUserNmuber, "|")[i] + "、";

                    model.ReceiverId = muser.UserID;
                    model.ReceiverName = muser.LogName;
                    model.IsRead = 0;
                    model.AllUser = 0;
                    model.UserGroupId = 0;
                    bll.Insert(model);
                }
            }
            Function.ShowSysMsg(1, "<li>成功向" + MyUserNumber.Substring(0, MyUserNumber.Length - 1) + "用户发送短消息!</li><li><a href='WebMessage/WebMessage.aspx'>继续发送短消息</a> <a href='WebMessage/WebMessageList.aspx'>返回短消息管理列表</a></li>");
        }
    }
コード例 #29
0
ファイル: SetSpecial.aspx.cs プロジェクト: suizhikuo/KYCMS
 /// <summary>
 /// 添加/修改专题
 /// </summary>
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     M_Special model = new M_Special();
     if (txtCName.Text.Trim() == "" || txtEName.Text.Trim() == "")
     {
         Function.ShowSysMsg(0, "<li>专题中文名和英文名不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
     }
     else
     {
         model.SpecialCName = txtCName.Text;
         model.SpecialEName = txtEName.Text;
     }
     string content = string.Empty;
     for (int i = 1; i <= 10; i++)
     {
         TextBox ctt = (TextBox)Page.FindControl("txtItemContent" + i);
         if (ctt.Text.Trim() != "")
         {
             content += ctt.Text;
         }
         content += "|";
     }
     content = content.Substring(0, content.Length - 1);
     model.IsCommand = rblIsRcmd.SelectedValue == "1";
     model.IsLock = rblIsLock.SelectedValue == "1";
     model.MetaKeyWord = "";
     model.MetaRemark = "";
     model.ParentID = int.Parse(ddlSpeacil.SelectedValue);
     model.SaveDirType = ddlDirType.SelectedValue;
     model.SiteID = int.Parse(ddlChannel.SelectedValue);
     model.SpecialAddTime = DateTime.Now;
     model.SpecialDomain = txtDomain.Text;
     B_SiteInfo site = new B_SiteInfo();
     model.SpecialRemark = site.GetFiltering(txtRemark.Text);
     model.SpecialContent = site.GetFiltering(content);
     model.SpecialItemNum = int.Parse(ddlItemNum.SelectedValue);
     model.Extension = rblExtension.SelectedValue;
     model.PicSavePath = "/" + txtPic.Text;
     if (txtTemplet.Text.Trim() == "")
     {
         Function.ShowSysMsg(0, "<li>专题模板路径不能为空</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
     }
     else
     {
         model.SpecialTemplet = txtTemplet.Text;
     }
     if (Key != 0)
     {
         model.ID = Key;
         model.SpecialAddTime = DateTime.Parse(txtAddTime.Text);
         model.IsDeleted = Boolean.Parse(txtIsdelete.Text);
         special.Update(model);
         Response.Redirect("SpecialList.aspx");
     }
     else
     {
         B_KyCommon kycomm = new B_KyCommon();
         if (kycomm.CheckHas(txtEName.Text, "SpecialEName", "KySpecial"))
         {
             Function.ShowSysMsg(0, "<li>专题英文名重复,请修改</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
         }
         else
         {
             special.Add(model);
             Response.Redirect("SpecialList.aspx");
         }
     }
 }
コード例 #30
0
ファイル: SetImage.aspx.cs プロジェクト: suizhikuo/KYCMS
    /// <summary>
    /// 添加/修改
    /// </summary>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        CheckInput();
        if (flag != "Update")//说明是新增
        {
            model = new M_Image();
            //model.AddTime = DateTime.Now;

            //添加时间
            if (txtAddTime.Text.Trim().Length != 0)
            {
                if (Function.IsDate(txtAddTime.Text.Trim().ToString()))
                    model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString());
                else
                    Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
            }
            else
                model.AddTime = DateTime.Now;

            model.IsCreated = false;
            model.IsDeleted = false;
            model.Status = 3;
        }
        else
        {
            //添加时间
            if (txtAddTime.Text.Trim().Length != 0)
            {
                if (Function.IsDate(txtAddTime.Text.Trim().ToString()))
                    model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString());
                else
                    Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
            }
            else
                model.AddTime = DateTime.Now;
        }
        model.AdminUId = adminModel.UserId;
        model.AdminUName = adminModel.AdminName;
        model.ChargeHourCount = Function.CheckNumber(txtChargeHourCount.Text) == true ? int.Parse(txtChargeHourCount.Text) : 0;
        for (int i = 1; i < 7; i++)
        {
            RadioButton chargType = Page.FindControl("rdBtnChargeType" + i) as RadioButton;
            if (chargType.Checked)
            {
                model.ChargeType = i;
                break;
            }
        }
        model.ChargeViewCount = Function.CheckNumber(txtChargeViewCount.Text) == true ? int.Parse(txtChargeViewCount.Text) : 0;
        model.ColId = int.Parse(Request.Form["ddlColumn"]);
        B_SiteInfo site=new B_SiteInfo();
        model.Content = site.GetFiltering(txtContent.Text);
        string GroupId="";
        for (int i = 0; i < UserGroup.Items.Count; i++)
        {
            if (UserGroup.Items[i].Selected)
            {
                GroupId += "|"+UserGroup.Items[i].Value;
            }
        }
        model.GroupIdStr = GroupId == "" ? "" : GroupId + "|";
        model.HitCount = Function.CheckNumber(txtHitCount.Text) == true ? int.Parse(txtHitCount.Text) : 0;
        model.ImgPath = string.IsNullOrEmpty(Request.Form["imgs"]) == true ? "" : "|" + Request.Form["imgs"].Replace(",", "|") + "|";
        model.IsAllowComment = property.Items[4].Selected;
        model.IsFocus = property.Items[2].Selected;
        model.IsOpened = int.Parse(rblIsOpened.SelectedValue);
        model.IsRecommend = property.Items[0].Selected;
        model.IsSideShow = (!rbTextTitle.Checked) && property.Items[3].Selected;
        model.IsTop = property.Items[1].Selected;
        model.PageType = rblPageType.SelectedIndex + 1;
        model.PointCount = Function.CheckNumber(txtPointCount.Text) == true ? int.Parse(txtPointCount.Text) : 0;
        string spclId = "";
        for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++)
        {
            if (lBoxTopicIdStr.Items[i].Selected)
            {
                spclId += "|" + lBoxTopicIdStr.Items[i].Value + "|";
            }
        }
        model.SpecialIdStr = spclId;
        #region 关键字
        string tagIdStr = string.Empty;
        string nameStr = txtTagNameStr.Text.Trim();
        nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase);
        if (nameStr.Length != 0)
        {
            if (nameStr.StartsWith("|"))
                nameStr = nameStr.Substring(1, nameStr.Length - 1);
            if (nameStr.EndsWith("|"))
                nameStr = nameStr.Substring(0, nameStr.Length - 1);
            B_Tag tagBll = new B_Tag();
            DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员");
            if (dr != null)
            {
                tagIdStr = "|" + dr[0] + "|";
                nameStr = "|" + dr[1] + "|";
            }
            else
            {
                tagIdStr = "";
                nameStr = "";
            }
        }
        model.TagIdStr = tagIdStr;
        model.TagNameStr = nameStr;
        #endregion
        model.TemplatePath = txtTemplatePath.Text;
        model.Title = site.GetFiltering(txtTitle.Text);
        model.TitleColor = txtHeaderColor.Text;
        model.TitleFontType = int.Parse(ddlFontType.SelectedValue);
        model.TitleImgPath = rbPicTitle.Checked ? txtPicTitlePath.Text : "";
        model.TitleType = rbTextTitle.Checked ? 1 : 2;
        model.UId = adminModel.UserId;
        model.UName = adminModel.AdminName;
        model.UpdateTime = DateTime.Now;
        model.UserType = 1;

        if (flag != "Update")
        {
            ImgId = imageBll.Add(model);

            if (property.Items[5].Selected)
            {
                DataRow dr = CreateBll.GetInfoById("kyimage", ImgId);
                CreateBll.CreateInfo(dr);
            }

            Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]);
        }
        else
        {
            imageBll.Update(model);
            if (property.Items[5].Selected)
            {
                DataRow dr = CreateBll.GetInfoById("kyimage", ImgId);
                CreateBll.CreateSingleInfo(dr);
            }
            Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]);
        }
    }