Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Button4.Attributes.Add("onclick", " if(!confirm('确认删除选中的图片吗!')) return false;");
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }

        else
        {
            this.Label1.Text = "欢迎管理员:" + Encryption.Decode(Session["issuper"]);
            footerload();
            showname();
            bind2();
            string poid = Request.QueryString["id"];
            if (poid != "5")//初始值
            {
                ddlclass.SelectedValue = poid;
            }
            else
            {
                ddlclass.SelectedValue = ddlclass.SelectedValue;
            }
        }
    }
Пример #2
0
    //载入
    protected void Page_Load(object sender, EventArgs e)
    {
        Button4.Attributes.Add("onclick", " if(!confirm('确认删除选中的用户吗?')) return false;");
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }

        else
        {
            this.Label1.Text = "欢迎管理员:" + Encryption.Decode(Session["issuper"]);
            aptips.InnerText = "";
            footerload();
            if (Session["suadmin"].ToString() == "True")
            {
                this.btnUser.Visible = true;
            }
            else
            {
                this.btnUser.Visible = false;
            }
        }
    }
Пример #3
0
        /// <summary>
        /// 添加图书评论
        /// </summary>
        /// <returns></returns>
        public string AddBookComment()
        {
            int    BookId      = int.Parse(context.Request.Form["iBookId"].ToString());
            User   u           = UserDal.CurrentUser();
            int    UserId      = u.UserId;
            string UserName    = u.UserName;
            string BookRemarks = context.Request.Form["sBookRemarks"].ToString();

            rm.Success = true;
            try
            {
                BookRemark bookRemark = new BookRemark();
                bookRemark.BookId      = BookId;
                bookRemark.UserId      = UserId;
                bookRemark.BookRemarks = BookRemarks;
                bookRemark.UserName    = UserName;
                bookRemark.ClientIP    = WebHelp.GetIP();
                bookRemark.CreatedTime = DateTime.Now;
                if (CRegex.FilterHTML(bookRemark.BookRemarks) == "")
                {
                    rm.Info = "内容不能为空";
                    return(jss.Serialize(rm));
                }
                int iBookRemarkId = BookDetailsDAL.m_BookRemarkDal.Add(bookRemark);
            }
            catch (Exception)
            {
                rm.Success = false;
                rm.Info    = "未知错误";
            }
            return(jss.Serialize(rm));
        }
Пример #4
0
        /// <summary>
        /// 注册限制
        /// </summary>
        /// <returns></returns>
        public static bool RegLimit()
        {
            bool           b    = true;
            List <dbParam> list = new List <dbParam>()
            {
                new dbParam()
                {
                    ParamName = "@ClientIP", ParamValue = WebHelp.GetIP()
                },
            };

            #region  一IP,同一当前日期(年月日),可以确定当天注册次数。
            List <User> uList       = UserDal.m_UserDal.GetList(" ClientIP=@ClientIP", list);
            int         count       = 0;
            string      DateCurrent = string.Format("{0:D}", DateTime.Now);//设置当前日期(年-月-日)
            foreach (var u in uList)
            {
                if (DateCurrent == string.Format("{0:D}", u.CreatedTime))
                {
                    count++;
                }
            }
            #endregion
            if (count >= 3)
            {
                b = false;
            }
            return(b);
        }
Пример #5
0
        public JsonResult Snapshot([FromBody] M_Phantom model)
        {
            Console.WriteLine(model.url);
            BaseResponse response = new BaseResponse();

            try
            {
                var picpath = $"upload/{Guid.NewGuid()}.png";
                var res     = WebHelp.GetHtmlImage(model.url, picpath);
                if (res == "ok\n")
                {
                    response.code = 200;
                    response.msg  = "成功";
                    response.data = picpath;
                }
                else
                {
                    response.code = 501;
                    response.msg  = $"转换图片失败:{res}";
                }
            }
            catch (Exception)
            {
                response.code = 500;
                response.msg  = "服务端错误";
            }
            return(new JsonResult(response));
        }
Пример #6
0
        /// <summary>
        /// 添加图书评论的回复2
        /// </summary>
        /// <returns></returns>
        public string AddBookCommentReplyAgain()
        {
            int BookRemarkReplyId = int.Parse(context.Request.Form["iBookRemarkReplyId"].ToString());
            //对哪条回复的回复
            BookRemarkReply ReplyTo  = BookDetailsDAL.m_BookRemarkReplyDal.GetModel(BookRemarkReplyId);
            int             UserId   = ReplyTo.UserId;
            string          UserName = "******" + ReplyTo.UserName;
            string          sBookRemarksReplyAgain = context.Request.Form["sBookRemarksReplyAgain"].ToString();

            rm.Success = true;
            try
            {
                BookRemarkReply bookRemarkReply = new BookRemarkReply();
                bookRemarkReply.BookRemarkId     = ReplyTo.BookRemarkId;
                bookRemarkReply.BookId           = ReplyTo.BookId;
                bookRemarkReply.UserId           = UserId;
                bookRemarkReply.BookRemarksReply = sBookRemarksReplyAgain;
                bookRemarkReply.UserName         = UserName;
                bookRemarkReply.ClientIP         = WebHelp.GetIP();
                bookRemarkReply.CreatedTime      = DateTime.Now;
                if (CRegex.FilterHTML(bookRemarkReply.BookRemarksReply) == "")
                {
                    rm.Info = "内容不能为空";
                    return(jss.Serialize(rm));
                }
                int iBookRemarkReplyId = BookDetailsDAL.m_BookRemarkReplyDal.Add(bookRemarkReply);
            }
            catch (Exception)
            {
                rm.Success = false;
                rm.Info    = "未知错误";
            }
            return(jss.Serialize(rm));
        }
Пример #7
0
        public static void ISelectTheElement(string ElementName)
        {
            string ElementLocator = AllPages.getElementLocator(ElementName);

            Assert.IsTrue(WebHelp.WaitToAppear(ElementLocator));
            WebHelp.SelectWebElement(ElementName);
        }
Пример #8
0
        public static void IEnterThisThere(string entry, string ElementName)
        {
            string ElementLocator = AllPages.getElementLocator(ElementName);

            Assert.IsTrue(WebHelp.WaitToAppear(ElementLocator));
            WebHelp.EnterInToWebelement(entry, ElementName);
        }
Пример #9
0
        public static void IShouldNotSeeTheElement(string ElementName)
        {
            string ElementLocator = AllPages.getElementLocator(ElementName);

            Assert.IsTrue(WebHelp.WaitToDisppear(ElementLocator));
            WebHelp.ITakeSceenShot();
        }
Пример #10
0
        public static void ISelectFromDropdown(string OptionText, string DropDownName)
        {
            string ElementLocator = AllPages.getElementLocator(DropDownName);

            Assert.IsTrue(WebHelp.WaitToAppear(ElementLocator));
            WebHelp.SelectFromDropDownBySelect(OptionText, DropDownName);
        }
Пример #11
0
    //发送通知邮件
    protected void mailno()
    {
        MailAddress MessageFrom    = new MailAddress("*****@*****.**");                             //发件人邮箱地址
        string      MessageTo      = "*****@*****.**";                                                 //收件人邮箱地址
        string      MessageSubject = "[丽军数码]网站有新动态!";                                                    //邮件主题
        string      MessageBody    = "<a href=\"http://lijun0772.com/\" target=\"_blank\">点此查看</a></p>"; //邮件内容

        WebHelp.Send(MessageFrom, MessageTo, MessageSubject, MessageBody);
    }
Пример #12
0
    //发送通知邮件
    protected void mailno()
    {
        MailAddress MessageFrom    = new MailAddress("*****@*****.**"); //发件人邮箱地址
        string      MessageTo      = "*****@*****.**";                     //收件人邮箱地址
        string      MessageSubject = "[丽军数码]有人发表了新留言!";                      //邮件主题
        string      MessageBody    = "<p>http://lijun0772.com/</p>";         //邮件内容

        WebHelp.Send(MessageFrom, MessageTo, MessageSubject, MessageBody);
    }
Пример #13
0
        public static void IShouldSeeTextInTheElement(string Text, string ElementName)
        {
            string ElementLocator = AllPages.getElementLocator(ElementName);

            Assert.IsTrue(WebHelp.WaitToAppear(ElementLocator));
            string TextToAssert = WebHelp.ReadFromWebelement(ElementName, "text");

            Assert.AreEqual(TextToAssert, Text);
            WebHelp.ITakeSceenShot();
        }
        public static void SignIn()
        {
            WebHelp.SelectWebElement("sign_in_button");

            WebHelp.EnterInToWebelement("user_name_field", "*****@*****.**");

            WebHelp.SelectWebElement("user_name_next_button");

            WebHelp.EnterInToWebelement("pass_word_field", "HelpingTesters");

            WebHelp.SelectWebElement("pass_word_next_button");
        }
Пример #15
0
    //发送验证邮件
    protected void mailv(string mailto, string usr)
    {
        MailAddress MessageFrom    = new MailAddress("*****@*****.**");                                                                                                                                   //发件人邮箱地址
        string      mailtoe        = Encryption.Decode(mailto);
        string      MessageTo      = mailtoe;                                                                                                                                                                  //收件人邮箱地址
        string      MessageSubject = "[丽军数码]验证邮箱地址";                                                                                                                                                           //邮件主题
        string      user           = Encryption.Auth(usr);                                                                                                                                                     //MD5
        string      mail           = Encryption.Auth(mailto);                                                                                                                                                  //MD5
        string      url            = "http://lijun0772.com/mailv.aspx?key=" + Encryption.Auth("黑我网站速度死!" + user) + mail;
        string      MessageBody    = "<p>" + Encryption.Decode(usr) + ",你好:<br/>请点击以下链接完成验证:<br/><a href=\"" + url + "\" target=\"_blank\">验证链接</a><br />如果你没有在本站评论或留言,请不要理会。</p><p align=\"right\">丽军数码</p>"; //邮件内容

        WebHelp.Send(MessageFrom, MessageTo, MessageSubject, MessageBody);
    }
Пример #16
0
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <returns></returns>
        public string RegUser()
        {
            string username  = context.Request.Form["username"].ToString();
            string pwd       = context.Request.Form["pwd"].ToString();
            string email     = context.Request.Form["email"].ToString();
            string phonenum  = context.Request.Form["phonenum"].ToString();
            string qq        = context.Request.Form["qq"].ToString();
            string checkcode = context.Request.Form["checkcode"].ToString();

            if (checkcode != context.Session["CheckCode"].ToString())//Session["CheckCode"] = rand;在image.aspx页面设置
            {
                rm.Success = false;
                rm.Info    = "验证码输入不正确";
            }
            else
            {
                try
                {
                    User user = new User();
                    user.UserName    = username;
                    user.Pwd         = pwd;
                    user.Gender      = "男";//默认为男,可在个人中心更改
                    user.Email       = email;
                    user.Tel         = phonenum;
                    user.QQ          = qq;
                    user.Type        = 0;               //1管理员 0普通用户
                    user.ClientIP    = WebHelp.GetIP(); //获取到访问者的IP
                    user.CreatedTime = DateTime.Now;
                    user.HeadPic     = "man.GIF";
                    if (!UserDal.RegLimit())
                    {
                        rm.Info = "sorry,一天最多只能注册三次";
                    }
                    else
                    {
                        int userid = UserDal.m_UserDal.Add(user);
                        //存储注册者的 ip/用户id/密码 并加密
                        cookieHelper.SetCookie("CLoginUser", cookieHelper.EncryptCookie(string.Format("{0}/{1}/{2}", WebHelp.GetIP(), userid, pwd)), 20);
                        rm.Success = true;
                        rm.Info    = "恭喜您,注册成功,3秒后返回首页...";
                    }
                }
                catch
                {
                    rm.Info = "未知错误";
                }
            }

            return(jss.Serialize(rm));
        }
Пример #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
        }

        else
        {
            Response.Redirect("adminweb.aspx");
        }
        footerload();
    }
Пример #18
0
    //载入
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }

        else
        {
            this.Label1.Text = "欢迎管理员:" + Encryption.Decode(Session["issuper"]);
            footerload();
        }
    }
Пример #19
0
 //验证管理员
 protected void ckadmin(string artid)
 {
     if (Session["issuper"] == null || Session["ispwd"] == null)
     {
         HyperLink1.Visible = false;
         HyperLink2.Visible = false;
     }
     else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
     {
         HyperLink1.Visible = false;
         HyperLink2.Visible = false;
     }
     else
     {
         //HyperLink1.NavigateUrl = "javascript:void if(!confirm('确认删除本文吗?')) return false;window.location.href='editpost.aspx?id=" + artid+"';";
         HyperLink1.NavigateUrl = "editpost.aspx?id=" + artid;
         HyperLink2.NavigateUrl = "detail.aspx?id=" + artid + "&ac=delete";
     }
 }
Пример #20
0
    //载入
    protected void Page_Load(object sender, EventArgs e)
    {
        Button4.Attributes.Add("onclick", " if(!confirm('确认删除选中的文章吗!')) return false;");
        if (!IsPostBack)
        {
            footerload();
        }
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }

        else
        {
            this.Label1.Text = "欢迎管理员:" + Encryption.Decode(Session["issuper"]);
        }
    }
Пример #21
0
        public static bool RegLimit()
        {
            bool           b    = true;
            List <dbParam> list = new List <dbParam>()
            {
                new dbParam()
                {
                    ParamName = "@ClientIP", ParamValue = WebHelp.GetIP()
                },
                new dbParam()
                {
                    ParamName = "@Time", ParamValue = DateTime.Now.ToString("yyyy-MM-dd")
                }
            };
            int count = m_UserInforDAL.GetCount(" RegIP=@ClientIP and CONVERT(varchar(100), CreatedTime, 23)=@Time", list);

            if (count >= 3)
            {
                b = false;
            }
            return(b);
        }
Пример #22
0
        /// <summary>
        /// 获取当前用户
        /// </summary>
        /// <returns></returns>
        public static User CurrentUser()
        {
            User user = null;

            if (System.Web.HttpContext.Current.Request.Cookies["CLoginUser"] == null || System.Web.HttpContext.Current.Request.Cookies["CLoginUser"].Value == "")
            {
                return(user);
            }
            else
            {
                //获取当前用户的Cookies并解密
                string   strLoginUser = cookieHelper.DecryptCookie(System.Web.HttpContext.Current.Request.Cookies["CLoginUser"].Value);
                string[] aLoginUser   = strLoginUser.Split('/');
                if (aLoginUser.Length != 3)
                {
                    user = null;
                }
                if (WebHelp.GetIP() != aLoginUser[0])
                {
                    user = null;
                }
                else
                {
                    user = UserDal.m_UserDal.GetModel("UserId=@UserId", new List <dbParam>()
                    {
                        new dbParam()
                        {
                            ParamName = "@UserId", ParamValue = Convert.ToInt32(Convert.ToInt32(aLoginUser[1]))
                        }
                    });
                    if (user.Pwd != aLoginUser[2])
                    {
                        user = null;
                    }
                }
            }
            return(user);
        }
Пример #23
0
    //载入
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["issuper"] == null || Session["ispwd"] == null)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }
        else if (WebHelp.Auth(Session["issuper"].ToString(), Session["ispwd"].ToString()) == false)
        {
            Response.Write("<script type='text/javascript'>alert('登录超时!');window.location.href='Default.aspx';</script>");
        }

        else
        {
            this.Label1.Text = "欢迎管理员:" + Encryption.Decode(Session["issuper"]);
            footerload();
            Ismid();
            string mid = Request.QueryString["mid"];
            if (!Ismid())
            {
                Response.Write("<script type='text/javascript'>alert('没有这条信息!');window.opener=null;window.open('','_self');window.close();</script>");
            }
        }
    }
Пример #24
0
        public bool InvokeAgentService(string apiName, Dictionary <string, object> parameters, out string outDataResponse, int channelId = 1000060)
        {
            outDataResponse = JsonConvert.SerializeObject(FailData);
            try
            {
                string ip = CommFunction.StringParse(HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"], "");
                if (string.IsNullOrEmpty(ip))
                {
                    ip = CommFunction.StringParse(HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], "");
                }

                if (parameters == null)
                {
                    parameters = new Dictionary <string, object>();
                }
                if (!parameters.ContainsKey("PubParams"))
                {
                    parameters.Add("PubParams", new { Ip = ip, ChannelId = channelId });
                }

                //获取请求地址
                var result = WebHelp.PostMode(SystemConfig.AgentInterfaceUri + "/" + apiName, JsonConvert.SerializeObject(parameters));
                if (string.IsNullOrEmpty(result))
                {
                    return(false);
                }
                else
                {
                    outDataResponse = result;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #25
0
        public static UserInfor CurrentUser()
        {
            UserInfor user = null;

            if (System.Web.HttpContext.Current.Request.Cookies["CLoginUser"] == null || System.Web.HttpContext.Current.Request.Cookies["CLoginUser"].Value == "")
            {
                return(user);
            }
            else
            {
                string   strLoginUser = cookieHelper.DecryptCookie(System.Web.HttpContext.Current.Request.Cookies["CLoginUser"].Value);
                string[] aLoginUser   = strLoginUser.Split('/');
                if (aLoginUser.Length != 3)
                {
                    user = null;
                }
                if (WebHelp.GetIP() != aLoginUser[0])
                {
                    user = null;
                }
                else
                {
                    user = m_UserInforDAL.GetModel("Xuehao=@xuehao", new List <dbParam>()
                    {
                        new dbParam()
                        {
                            ParamName = "@xuehao", ParamValue = aLoginUser[1].ToString()
                        }
                    });
                    if (user.password != aLoginUser[2])
                    {
                        user = null;
                    }
                }
            }
            return(user);
        }
Пример #26
0
        void WindowMain_Activated(object sender, EventArgs e)
        {
            Activated -= new EventHandler(WindowMain_Activated);
            if (true /*!Rawr.Properties.GeneralSettings.Default.WelcomeScreenSeen*/)
            {
                ChildWindow window = new WelcomeWindow();
                window.Owner = this;
                window.ShowDialog();

                if (!Rawr.Properties.GeneralSettings.Default.HasSeenHelpWindow)
                {
                    MessageBox.Show(
                        @"Rawr has added a new feature, the Rawr Web Help Window. The Web Help Window is designed to provide fast access to common help topics.

In the Downloadable Version of Rawr (WPF), you will be provided with a mini-webbrowser which displays relevant topics as seen on our Documentation pages. In Silverlight, the online version of Rawr, you will be prompted with quick links to open the content in your browser. We are working to provide web content directly in here as well.

You will now be taken to this window to become familiar with it.",
                        "New Information!", MessageBoxButton.OK); Rawr.Properties.GeneralSettings.Default.HasSeenHelpWindow = true;
                    ChildWindow window2 = new WebHelp("WhereToStart", "");
                    window2.Owner = this;
                    window2.ShowDialog();
                }
            }
        }
Пример #27
0
        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="context"></param>
        /// <param name="tel"></param>
        /// <returns></returns>
        public static bool SendSms(string context, string tel)
        {
            string postData = @"action=Send&username=15080453548&password=617899BEADC8A0C73C2A7B566EF7E9E6&gwid=86&mobile=" + tel + "&message=" + HttpUtility.UrlEncode(context, Encoding.GetEncoding("GBK"));
            string smsUrl   = ConfigurationManager.AppSettings["SmsUrl"];

            try
            {
                var result = WebHelp.PostModeGBK(smsUrl, postData);
                if (result.Length > 0)
                {
                    var sms = JsonConvert.DeserializeObject <SmsModel>(result);
                    return(sms.CODE == 1 ? true : false);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _Logger.Error($"短信接口{smsUrl} 异常 ", ex);
                return(false);
            }
        }
Пример #28
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <returns></returns>
        public string UserLogin()
        {
            string username = context.Request.Form["username"].ToString();
            string pwd      = context.Request.Form["pwd"].ToString();

            try
            {
                List <dbParam> list = new List <dbParam>()
                {
                    new dbParam()
                    {
                        ParamName = "@UserName", ParamValue = username
                    },
                    new dbParam()
                    {
                        ParamName = "@Pwd", ParamValue = pwd
                    }
                };
                User user = UserDal.m_UserDal.GetModel("UserName=@UserName and Pwd=@Pwd", list);
                //保存UserId,为后面的页面使用;比如购物车页面。
                //HttpContext.Current.Session["UserId"] = user.UserId;
                cookieHelper.SetCookie("UserId", user.UserId.ToString(), 3600);
                if (user != null)
                {
                    //存储登录者的 ip/用户id/密码 并加密
                    cookieHelper.SetCookie("CLoginUser", cookieHelper.EncryptCookie(string.Format("{0}/{1}/{2}", WebHelp.GetIP(), user.UserId, user.Pwd)), 60);
                    rm.Success = true;
                }
                else
                {
                    rm.Info = "用户名或密码错误";
                }
            }
            catch
            {
                rm.Info = "未知错误";
            }

            return(jss.Serialize(rm));
        }
Пример #29
0
 public static void IWaitSomeSecunds(int wait)
 {
     WebHelp.WaitSomeSec(wait);
 }
Пример #30
0
 public static void INavigateToAURL(string url)
 {
     WebHelp.NavigateTo(url);
 }