Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string flag = "false";

            flag = Request["flag"];
            if (flag == "true")
            {
                string   name = "", psw = "", mail = "";
                mysql    sql   = new mysql();
                xssfile  xs    = new xssfile();
                desclass mydes = new desclass();
                name = Request["name"];
                psw  = Request["mima1"];
                mail = Request["mail"];



                if (name == "" || psw == "" || mail == "")
                {
                    Label4.Text = "用户名或密码或邮箱不能为空";
                }
                else
                {
                    name = xs.filet(name);
                    psw  = xs.filet(psw);
                    mail = xs.filet(mail);

                    Regex regn     = new Regex(@"^[A-Za-z0-9_]+$");
                    bool  nameisok = regn.IsMatch(name);
                    if (nameisok == false)
                    {
                        Response.Write("用户名必须是3 -16个字母,数字,下划线"); return;
                    }

                    Regex regm     = new Regex(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
                    bool  mailisok = regn.IsMatch(mail);
                    if (nameisok == false)
                    {
                        Response.Write("邮箱格式不正确"); return;
                    }


                    psw = mydes.EnCode(psw);
                    psw = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(psw, "MD5");
                    sql.register(name, psw, mail);

                    createfile(name);

                    Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "login.aspx");
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            xssfile  xf    = new xssfile();
            mysql    sql   = new mysql();
            desclass mydes = new desclass();
            string   flag  = "false";

            flag = Request["flag"];

            string mycookie  = "";
            string mysession = "";

            try
            {
                mysession = Session["username"].ToString();
            }
            catch
            { mysession = null; }

            try
            {
                mycookie = Request.Cookies["name"].Value;
            }
            catch
            {
                mycookie = null;
            }
            string ownname = mydes.yanzheng(mycookie, mysession);

            if (ownname != null)
            {
                if (flag == "true")
                {
                    string codetitle    = Request["codetitle"];
                    string codeducument = Request["codeducument"];
                    string beizhu       = Request["beizhu"];
                    string mynname      = ownname;
                    string yuancode     = codeducument;
                    codetitle = xf.filet(codetitle);
                    //   codeducument = xf.filet(codeducument);
                    beizhu = xf.filet(beizhu);

                    sql.createcode(mynname, codetitle, codeducument, beizhu, yuancode);

                    Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "viewcode.aspx");
                }
            }
            else
            {
                Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "login.aspx");
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request["FormView1$button1"].ToString() == "提交编辑代码")
                {
                    mysql   sql      = new mysql();
                    xssfile xs       = new xssfile();
                    string  beizhu   = Request["FormView1$beizhu"];
                    string  document = Request["FormView1$mycodedocument"];
                    string  title    = Request["FormView1$mycodename"];
                    string  codeid   = Request["codeid"];

                    beizhu = xs.filet(beizhu);
                    title  = xs.filet(title);


                    sql.updatecode(codeid, title, document, beizhu);

                    Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "success.html");
                    return;
                }
            }
            catch
            {
            }
            string   mycookie  = "";
            string   mysession = "";
            desclass mydes     = new desclass();

            try
            {
                mysession = Session["username"].ToString();
            }
            catch
            { mysession = null; }

            try
            {
                mycookie = Request.Cookies["name"].Value;
            }
            catch
            {
                mycookie = null;
            }
            string ownname = mydes.yanzheng(mycookie, mysession);

            if (ownname != null)
            {
                mycodeid = Request["codeid"];
                if (mycodeid == "" || mycodeid == null)
                {
                    Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "viewcode.aspx"); return;
                }
                mynameis = ownname;

                mysql sql = new mysql();

                FormView1.DataSource = sql.viewcode(mycodeid, ownname, 3);
                FormView1.DataBind();
            }
            else
            {
                Response.Redirect(System.Configuration.ConfigurationManager.AppSettings["localurl"].ToString() + "login.aspx");
            }
        }