Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            string userId       = DEncryptUtils.DESDecrypt(CookieHelper.GetCookieValue("52cos", "user_id")).Replace("\0", "");
            string type         = context.Request.Form["comment_parent"];
            string workId       = context.Request.Form["comment_post_ID"];
            string replyContent = context.Request.Form["comment"];
            string s            = "{\"status\":\"error\"}";

            if (userId.Trim() != "")
            {
                ReplyEntity replyEntity = new ReplyEntity();
                replyEntity.User_id      = userId;
                replyEntity.type         = type;
                replyEntity.workId       = workId;
                replyEntity.ReplyContent = replyContent;
                replyEntity.ReleaseTime  = DateTime.Now;
                //插入回复表
                if (ReplyBll.Instance.Add(replyEntity) > 0)
                {
                    // todo 更新作品时间
                    s = "{\"status\":\"success\"}";
                }
            }

            context.Response.ContentType = "text/plain";
            context.Response.Charset     = "utf-8";
            context.Response.Write(s);
        }
        public void TestRevEnc()
        {
            //可逆加密
            //des
            string desEncode = DEncryptUtils.DESEncrypt(txt, key);

            Console.WriteLine("des加密值:" + desEncode);
            Assert.AreEqual(txt, DEncryptUtils.DESDecrypt(desEncode, key));

            //aes
            string aesEncode = DEncryptUtils.AESEncrypt(txt);

            Console.WriteLine("aes加密值:" + aesEncode);
            Assert.AreEqual(txt, DEncryptUtils.AESDecrypt(aesEncode));

            //base64
            string base64Encode = DEncryptUtils.Base64Encrypt(txt);

            Console.WriteLine("base64加密值:" + aesEncode);
            Assert.AreEqual(txt, DEncryptUtils.Base64Decrypt(base64Encode));

            //xor
            string xor = DEncryptUtils.GetXORCode(txt, key);

            Console.WriteLine("xor加密值:" + xor);
            Assert.AreEqual(txt, DEncryptUtils.GetXORCode(xor, key));
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            string userId         = DEncryptUtils.DESDecrypt(CookieHelper.GetCookieValue("52cos", "user_id")).Replace("\0", "");
            string classification = context.Request.Form["theme_custom_post_source[type]"];            //作品、合作、活动
            string worksTitle     = context.Request.Form["ctb[post-title]"];                           //作品标题
            string worksExcerpt   = context.Request.Form["ctb[post-excerpt]"];                         //作品摘要
            string worksContent   = context.Request.Form["ctb[post-content]"];                         //作品内容
            string worksType      = context.Request.Form["ctb[cats][]"];                               //作品分类
            string labelDesc      = context.Request.Form["ctb[tags][]"];                               //作品标签
            string source         = context.Request.Form["theme_custom_post_source[source]"];          //来源
            string sourceUrl      = context.Request.Form["theme_custom_post_source[reprint][url]"];    //来源地址
            string author         = context.Request.Form["theme_custom_post_source[reprint][author]"]; //作者
            string cover          = context.Request.Form["ctb[thumbnail-id]"];                         //封面id
            string imgs           = context.Request.Form["ctb[attach-ids][]"];                         //原图id组

            int i = 0;

            string[] types = worksType.Split(',');
            string[] imgss = imgs.Split(',');
            if (classification == "works") //作品
            {
                i = SaveWorks(userId, worksTitle, worksExcerpt, worksContent, labelDesc, source, sourceUrl, author, cover, types);
            }
            if (classification == "reprint") //合作
            {
                i = SaveReprint(userId, worksTitle, worksExcerpt, worksContent, cover);
            }
            if (classification == "activity") //活动
            {
                i = SaveActivity(userId, worksTitle, worksExcerpt, worksContent, cover);
            }



            context.Response.ContentType = "text/plain";
            context.Response.Charset     = "utf-8";
            context.Response.Write(i);
        }
Example #4
0
        public void ProcessRequest(HttpContext context)
        {
            string userId = DEncryptUtils.DESDecrypt(CookieHelper.GetCookieValue("52cos", "user_id")).Replace("\0", "");
            string img    = context.Request.Form["b4"];
            string strReturn;

            MemberEntity memberEntity = MemberBll.Instance.GetModel(Convert.ToInt32(userId));

            memberEntity.Portrait = UploadFile.UploadImg(img, "Upload\\Portrait\\");
            bool b = MemberBll.Instance.Update(memberEntity);

            if (b)
            {
                strReturn = "{\"status\":\"success\"}";
            }
            else
            {
                strReturn = "{\"status\":\"error\"}";
            }

            context.Response.ContentType = "text/plain";
            context.Response.Charset     = "utf-8";
            context.Response.Write(strReturn);
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (CookieHelper.GetCookieValue("52cos", "user_id") != null && CookieHelper.GetCookieValue("52cos", "pwd") != "")
            {
                string userId            = DEncryptUtils.DESDecrypt(CookieHelper.GetCookieValue("52cos", "user_id")).Replace("\0", "");
                string pwd               = CookieHelper.GetCookieValue("52cos", "pwd");
                List <MemberEntity> list = MemberBll.Instance.GetModelList("User_id='" + userId + "' AND Password='******'");
                if (list.Count > 0)
                {
                    this.MemberEntity = list[0];

                    if (Session["UserInfo"] == null)
                    {
                        Session["UserInfo"] = this.MemberEntity;
                    }

                    //RecordIp(userId);
                    //UpdateLoginIp(userId);
                    //BindMenu();
                    //#region MyRegion
                    //string s = string.Format(@"<div class='tool tool-me'>
                    //                                <a href='/zl/zl-{1}.html'><!--用户主页地址-->
                    //                                 <img class='avatar' width='32' height='32' src='{0}' alt='avatar'><!--头像-->
                    //                                 <i class='fa fa-angle-down'></i>
                    //                                </a>
                    //                                <div class='box'>
                    //                                 <!-- points -->
                    //                                 <div class='box-points'>
                    //                                  <a href='/zl/zl-{1}.html' alt='0/10000'>
                    //                                   <img src='/Style/img/integral.gif' alt='' width='16' height='16'>
                    //                                   Level {5}
                    //                                  </a>
                    //                                 </div>
                    //                                 <div class='box-points'>
                    //                                  <a href='/yh/history.html'>
                    //                                   <img src='/Style/img/integral.gif' alt='' width='16' height='16' title='{2} 节操 {3} 热心 {4} CN币 {6} 身家'>
                    //                                   {2} 节操 {6} 身家
                    //                                  </a>
                    //                                 </div>
                    //                                 <ul>
                    //                                  <li class=''>
                    //                                   <a href='/yh/dashboard.html'>
                    //                                    <i class='fa fa-dashboard fa-fw'></i>
                    //                                    用户中心
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/contributions.html'>
                    //                                    <i class='fa fa-paint-brush fa-fw'></i>
                    //                                    文章投稿
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/mytg.html'>
                    //                                    <i class='fa fa-lightbulb-o fa-fw'></i>
                    //                                    我的投稿
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/translate.html'>
                    //                                    <i class='fa fa-envelope fa-fw'></i>
                    //                                    私信
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/bomb.html'>
                    //                                    <i class='fa fa-bomb fa-fw'></i>
                    //                                    轰炸小游戏
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/notifications.html'>
                    //                                    <i class='fa fa-bell fa-fw'></i>
                    //                                    我的提醒
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/history.html'>
                    //                                    <i class='fa fa-history fa-fw'></i>
                    //                                    积分历史
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/settings.html'>
                    //                                    <i class='fa fa-cog fa-fw'></i>
                    //                                    我的设置
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/medal.html'>
                    //                                    <i class='fa fa-bookmark fa-fw'></i>
                    //                                    勋章中心
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/lottery.html'>
                    //                                    <i class='fa fa-yelp fa-fw'></i>
                    //                                    积分商城
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/avatar.html'>
                    //                                    <i class='fa fa-github-alt fa-fw'></i>
                    //                                    我的头像
                    //                                   </a>
                    //                                  </li>
                    //                                        <li class=''>
                    //                                   <a href='/yh/recharge.html'>
                    //                                    <i class='fa fa-database'></i>
                    //                                    立刻充值
                    //                                   </a>
                    //                                  </li>
                    //                                        <li class=''>
                    //                                   <a href='/yh/exchange.html'>
                    //                                    <i class='fa fa-link'></i>
                    //                                    发布兑换
                    //                                   </a>
                    //                                  </li>
                    //                                  <li class=''>
                    //                                   <a href='/yh/password.html'>
                    //                                    <i class='fa fa-lock fa-fw'></i>
                    //                                    修改密码
                    //                                   </a>
                    //                                  </li>
                    //                                  <li><a href='/prompts.html'><i class='fa fa-sign-out fa-fw'></i>登出</a></li>
                    //                                 </ul>
                    //                                </div>
                    //                                </div>",
                    //dt.Rows[0]["portrait"], userId, dt.Rows[0]["integral"], dt.Rows[0]["ardent"], dt.Rows[0]["CNbi"], dt.Rows[0]["Ugrade"], dt.Rows[0]["Shenjia"]);
                    //userbar.InnerHtml = s + "<a href=\"javascript:;\" class=\"tool search fa fa-search fa-2x\" data-toggle-target=\"#fm-search\" data-focus-target=\"#fm-search-s\" data-icon-active=\"fa-arrow-down\" data-icon-original=\"fa-search\" title=\"搜索\"></a>";
                    //#endregion
                }
            }
        }
Example #6
0
 /// <summary>
 /// 数据库字符串解密
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button2_Click(object sender, EventArgs e)
 {
     textBox1.Text = DEncryptUtils.DESDecrypt(textBox2.Text);
 }