protected void Button1_Click(object sender, EventArgs e)
    {
        string pinglun = Request.Form["pingluntext"];//评论信息

        if (pinglun.Equals(""))
        {
            Response.Write("<script>alert('内容不能为空!')</script>");
        }
        else
        {
            for (int i = 0; i < 61; i++)
            {
                //改变代码
                pinglun = pinglun.Replace("a" + i + ".gif", "<img src=images/face/a" + i + ".gif/>");
            }
            string        id   = Request.Params["suc_dfdfddff"];
            Datacon       dc   = new Datacon();
            SqlConnection conn = dc.SQL_con();
            if (conn.State == System.Data.ConnectionState.Closed)
            {
                conn.Open();
            }
            string     str  = "insert into [shine_sucai_pinglun] (sucai_id,pinglun_yonghu,touxiang,pinglun_neirong) values('" + id + "','" + Session["user"] + "','qq.png','" + pinglun + "')";
            SqlCommand comm = new SqlCommand(str, conn);
            if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
            {
                // 在此处放置用户代码以初始化页面
                pingluns();
            }
            else
            {
                WebMessageBox.Show("评论出错!", "sucaiDetail_sub.aspx?suc_dfdfddff=" + id);
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Datacon       dc   = new Datacon();
        SqlConnection conn = dc.SQL_con();

        if (conn.State == System.Data.ConnectionState.Closed)
        {
            conn.Open();
        }
        string     url  = Request.Url.ToString();
        string     str  = "insert into [shine_sucai_shoucang] (shoucang_id,shoucang_url) values('" + Session["user"] + "','" + url + "')";
        SqlCommand comm = new SqlCommand(str, conn);

        if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
        {
            // 在此处放置用户代码以初始化页面

            string id = Request.Params["suc_dfdfddff"];
            WebMessageBox.Show("恭喜,收藏成功!", "sucaiDetail_sub.aspx?suc_dfdfddff=" + id);
        }
        else
        {
            WebMessageBox.Show("未来收藏!", "Logon.aspx");
        }
        if (conn.State == System.Data.ConnectionState.Open)
        {
            conn.Close();
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.Params["id"];

        if (id == null)
        {
            Response.Redirect("index1.aspx");
        }
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select * from new where id='" + id + "'", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "new");
        DataList1.DataSource = ds;
        DataList1.DataBind();
        con.Close();

        /* string sql = "select  from new where id='" + id + "'";
         * SqlCommand cmd = new SqlCommand(sql, con);
         * SqlDataReader dr = cmd.ExecuteReader();
         * while (dr.Read())
         * {
         *   article.Text = dr["topic"].ToString();
         * }
         *
         * string s = "select topic from new where id='" + id + "'";
         * SqlDataAdapter da1 = new SqlDataAdapter(s, con);
         * DataSet ds1 = new DataSet();
         *
         * Response.Write(ds1);
         *
         * Label1.Text = Convert.ToString(Session["i_tool"]);*/
    }
Example #4
0
    public void online()
    {
        Datacon       dc   = new Datacon();
        SqlConnection conn = dc.SQL_con();

        if (conn.State == System.Data.ConnectionState.Closed)
        {
            conn.Open();
        }
        String     online1         = HttpContext.Current.Request.UserHostAddress;
        string     strHostName     = System.Net.Dns.GetHostName();
        string     clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
        string     str             = "insert into [shine_online] (上线地点,ip地址,use_num) values('" + clientIPAddress + "','" + online1 + "','" + Session["user"].ToString() + "')";
        SqlCommand comm            = new SqlCommand(str, conn);

        if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
        {
        }
        else
        {
        }
        if (conn.State == System.Data.ConnectionState.Open)
        {
            conn.Close();
        }
    }
Example #5
0
    protected void LinkButton2_Click1(object sender, EventArgs e)
    {
        string        id  = Request.Params["fdfdfdf"];
        String        str = "";
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_sucai] where id=" + id + "", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_message");
        if (ds.Tables["shine_message"].Rows.Count == 0)
        {
            Response.Write("没有查询到数据,请重试");
        }
        else
        {
            Response.Write("<br>");
            for (int i = 0; i < ds.Tables["shine_message"].Rows.Count; i++)
            {
                str = (ds.Tables["shine_message"].Rows[i]["file_zip_url"]).ToString();
            }
            Response.Redirect("file/zuopin/" + str);
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //获取客户端的ip地址
        string strHostName = System.Net.Dns.GetHostName();
        string userip      = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();

        //创建cookie对象:


        if (Session["ipaddress"] == null)
        {
            Session["ipaddress"] = userip;
            Datacon       dc  = new Datacon();
            SqlConnection con = dc.SQL_con();
            //更新语句
            con.Open();
            String     str    = "update shine_sucai_zan set dianzan_shu=dianzan_shu+1 where id='1' ";
            SqlCommand comm   = new SqlCommand(str, con);
            int        record = Convert.ToInt32(comm.ExecuteNonQuery());
            if (record > 0)
            {
                bingdate();
            }
            con.Close();
        }
    }
Example #7
0
 protected void LoginButton_Click(object sender, EventArgs e)
 {
     if (lblCheckCode.Text.Trim() != txtCheckCode.Text.Trim())    //判断验证码
     {
         WebMessageBox.Show("验证码不正确,请重新输入!");
     }
     else
     {
         string        name = UserName.Text.Trim();
         string        pass = Password.Text.Trim();
         Datacon       dc   = new Datacon();
         SqlConnection conn = dc.SQL_con();
         if (conn.State == System.Data.ConnectionState.Closed)
         {
             conn.Open();
         }
         string        str  = "select * from userlogin where username='******' and pwd='" + pass + "' ";
         SqlCommand    comm = new SqlCommand(str, conn);
         SqlDataReader dr   = comm.ExecuteReader();
         if (name == "" | pass == "")
         {
             Response.Write("<script>alert('不能为空!')</script>");
         }
         else if (dr.Read())
         {
             Session["user"] = name;
             Response.Redirect("index1.aspx");
         }
         else
         {
             Response.Write("<script>alert('登录失败!请确保已注册且用户名密码不为空!')</script>");
         }
     }
 }
Example #8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        String title    = TextBox1.Text;            //获取标题
        String validate = TextBox2.Text;            //获取验证码
        String contents = Request.Form["content1"]; //获取内容

        if (contents.Equals("") && title.Equals("") && validate.Equals(""))
        {
            Response.Write("<script>alert('不能为空!')</script>");
        }

        else
        {
            if (String.Compare(Request.Cookies["yzmcode"].Value, this.TextBox2.Text, true) != 0)
            {
                Response.Write("<script>alert('验证码错误!')</script>");
                TextBox2.Text = "";
            }
            else
            {
                Datacon       dc        = new Datacon();
                SqlConnection con       = dc.SQL_con();
                string        answerid  = "";
                int           answer_id = 0;
                //建立数据库连接
                if (con.State == System.Data.ConnectionState.Closed)
                {
                    //如果数据库连接处于关闭状态  则打开数据库
                    con.Open();
                    SqlCommand sqlcommand = new SqlCommand("select answerid from Question where id=(select max(id) from Question)", con);
                    answerid  = sqlcommand.ExecuteScalar().ToString();
                    answer_id = int.Parse(answerid);
                    answer_id++;
                }
                //创建SQL语句
                string sqlstr = "insert into Question(title,question,answerid) values('" + title + "','" + contents + "','" + answer_id + "')";

                //创建SQLcommand对象
                SqlCommand conmm = new SqlCommand(sqlstr, con);
                //打开数据库连接
                if (Convert.ToInt32(conmm.ExecuteNonQuery()) > 0)
                {
                    content1.Text = "";
                    Response.Write("<script> alert('恭喜,发表成功');</script>");
                    // Response.Redirect("index_forum.aspx");
                }
                else
                {
                    Response.Write("<script> alert('数据添加失败!');</script>");
                }
            }
        }
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT top 12 * FROM [shine_sucai]", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_sucai");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #10
0
    protected void LinkButton1_Click1(object sender, EventArgs e)
    {
        string        id  = Request.Params["fdfdfdf"];
        String        str = "";
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_sucai] where id=" + id + "", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_message");
        if (ds.Tables["shine_message"].Rows.Count == 0)
        {
            Response.Write("没有查询到数据,请重试");
        }
        else
        {
            Response.Write("<br>");
            for (int i = 0; i < ds.Tables["shine_message"].Rows.Count; i++)
            {
                str = (ds.Tables["shine_message"].Rows[i]["file_zip_url"]).ToString();
            }

            Datacon       dcc  = new Datacon();
            SqlConnection conn = dc.SQL_con();
            //更新语句
            conn.Open();
            String     strs   = "update shine_sucai set xiazailiang=xiazailiang+1 where id='" + id + "' ";
            SqlCommand commd  = new SqlCommand(strs, con);
            int        record = Convert.ToInt32(commd.ExecuteNonQuery());
            if (record > 0)
            {
                //链接到下载界面
                Response.Redirect("file/zuopin/" + str);
            }
            con.Close();
        }
    }
    public void pingluns()
    {
        string        id  = Request.Params["suc_dfdfddff"];
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT *  FROM [shine_sucai_pinglun]  where sucai_id='" + id + "' order by time desc  ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_sucai_pinglun");
        con.Close();
    }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [pinglun]", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "pinglun");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_sucai] where use_num='" + Session["user"] + "' ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_sucai");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select c1=count(id),c2=(select count(id) from shine_message where state='未读' and message_uer='" + Session["user"] + "' ),c3=(select count(id) from shine_message where message_uer='" + Session["user"] + "'  ) from shine_message where state='已读' and message_uer='" + Session["user"] + "' ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_message");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_message] where message_uer='" + Session["user"] + "' and state='未读'  ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "pinglun");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #16
0
    protected void updata_datalist()
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [Question]", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "Question");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #17
0
    public void xiaoxi()
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select count(id) as num from shine_message where message_uer='3' ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_message");
        con.Close();
        DataListaa.DataSource = ds;
        DataListaa.DataBind();
    }
    public void bingdate()
    {
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("SELECT *  FROM [shine_sucai_zan]  ", con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_sucai_zan");
        con.Close();
        DataList5.DataSource = ds;
        DataList5.DataBind();
    }
Example #19
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        String old_pass  = TextBox1.Text;
        String new_pass1 = TextBox2.Text;
        String new_pass2 = TextBox3.Text;
        //获取旧密码;
        Datacon       dc  = new Datacon();
        SqlConnection con = dc.SQL_con();

        con.Open();


        if (old_pass.Equals(""))
        {
        }
    }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] != null)
        {
            SqlConnection con = dc.SQL_con();
            con.Open();

            //string md5_name; //加密后数据
            //md5_name = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile( Session["user"].ToString() , "MD5");

            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [User_login] where use_num='" + Session["user"].ToString() + "' ", con);
            DataSet        ds = new DataSet();
            da.Fill(ds, "User_login");
            con.Close();
            DataList1.DataSource = ds;
            DataList1.DataBind();
        }
        else
        {
            Response.Write("<script>alert('登陆失效!请重新登陆')</script>");
        }
    }
Example #21
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //登陆响应事件
        String name = TextBox1.Text;
        //string md5_name; //加密后数据
        //md5_name = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(name, "MD5");

        String pass = TextBox2.Text;
        string md5_pass; //加密后数据

        md5_pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pass, "MD5");

        Datacon       dc   = new Datacon();
        SqlConnection conn = dc.SQL_con();

        if (conn.State == System.Data.ConnectionState.Closed)
        {
            conn.Open();
        }
        string        str  = "select * from [User_login] where use_num='" + name + "' and password='******' ";
        SqlCommand    comm = new SqlCommand(str, conn);
        SqlDataReader dr   = comm.ExecuteReader();

        if (name == "" | pass == "")
        {
            Response.Write("<script>alert('不能为空!')</script>");
        }
        else if (dr.Read())
        {
            Session["user"] = name;
            online();
            WebMessageBox.Show("登陆成功!", "index1.aspx");
        }
        else
        {
            Response.Write("<script>alert('登陆失败,检查用户名密码!')</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.Params["suc_dfdfddff"];

        if (id == null)
        {
            Response.Redirect("sucaiDetail_sub1.aspx?suc_dfdfddff=2");
        }
        else
        {
            Datacon       dc  = new Datacon();
            SqlConnection con = dc.SQL_con();
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_sucai] where id=" + id + "", con);
            DataSet        ds = new DataSet();
            da.Fill(ds, "shine_message");
            con.Close();
            DataList1.DataSource = ds;
            DataList1.DataBind();
            pingluns();
        }
        bingdate();
    }
Example #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String str  = "";
        string type = Request.Params["tt"];

        if (type == null || type.Equals("全部"))
        {
            str = "SELECT * FROM [shine_sucai]";
        }
        else
        {
            str = "SELECT * FROM [shine_sucai] where type='" + type + "'";
        }
        SqlConnection con = dc.SQL_con();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter(str, con);
        DataSet        ds = new DataSet();

        da.Fill(ds, "shine_sucai");
        con.Close();
        DataList1.DataSource = ds;
        DataList1.DataBind();
    }
Example #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.Params["fdfdfdf"];

        if (id == null)
        {
            Response.Redirect("sucaiDetail.aspx");
        }
        else
        {
            Datacon       dc  = new Datacon();
            SqlConnection con = dc.SQL_con();
            con.Open();
            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [shine_sucai] where id=" + id + "", con);
            DataSet        ds = new DataSet();
            da.Fill(ds, "shine_message");
            //if (ds.Tables["shine_message"].Rows.Count == 0)
            //{
            //    Response.Write("没有查询到数据,请重试");

            //}
            //else
            //{
            //    Response.Write("<br>");
            //    for (int i = 0; i < ds.Tables["shine_message"].Rows.Count; i++)
            //    {
            //        Response.Write(ds.Tables["shine_message"].Rows[i]["file_zip_url"] + "<br>");
            //    }


            //}
            con.Close();
            DataList1.DataSource = ds;
            DataList1.DataBind();
        }
    }
Example #25
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        //注册用户:
        if (TextBox1.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('账号不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox5.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('昵称不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox6.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('手机号不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox7.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('验证码不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox2.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('密码不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox4.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('密码不能为空!', 3000, 'rounded');</script>");
        }
        else if (TextBox3.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('邮箱不能为空!', 3000, 'rounded');</script>");
        }

        else
        {
            Datacon       dcc   = new Datacon();
            SqlConnection connn = dcc.SQL_con();
            if (connn.State == System.Data.ConnectionState.Closed)
            {
                connn.Open();
            }
            string        strs  = "select * from [User_login] where use_num='" + TextBox5.Text + "'  ";
            SqlCommand    commm = new SqlCommand(strs, connn);
            SqlDataReader dr    = commm.ExecuteReader();
            if (dr.Read())
            {
                Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('用户已存在!', 3000, 'rounded');</script>");
            }

            else
            {
                if (TextBox7.Text.Equals(Session["codes"]))
                {
                    if (!(TextBox2.Text.Equals(TextBox4.Text)))
                    {
                        Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('两次密码不一致!', 3000, 'rounded');</script>");
                    }
                    else
                    {
                        String name_num = TextBox1.Text;
                        //string md5_name_num; //加密后数据
                        //md5_name_num = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(name_num, "MD5");
                        String pass1 = TextBox2.Text;
                        string md5_pass1; //加密后数据
                        md5_pass1 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pass1, "MD5");
                        String        email   = TextBox3.Text;
                        String        pass2   = TextBox4.Text;
                        String        name    = TextBox5.Text;
                        string        jianjie = Request.Form["OrderNote"]; //个人简介
                        String        sex     = Request.Form["sex"];       //性别
                        String        g1      = Request.Form["g1"];        //喜好
                        String        g2      = Request.Form["g2"];        //喜好
                        String        g3      = Request.Form["g3"];        //喜好
                        String        g4      = Request.Form["g4"];        //喜好
                        String        like    = g1 + "," + g2 + "," + g3 + "," + g4 + "";
                        Datacon       dc      = new Datacon();
                        SqlConnection conn    = dc.SQL_con();
                        if (conn.State == System.Data.ConnectionState.Closed)
                        {
                            conn.Open();
                        }
                        string     str  = "insert into [User_login] (use_num,use_name,password,email,sex,jianshu,like1) values('" + name_num + "','" + name + "','" + md5_pass1 + "','" + email + "','" + sex + "','" + jianjie + "','" + like + "')";
                        SqlCommand comm = new SqlCommand(str, conn);
                        if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
                        {
                            // 在此处放置用户代码以初始化页面
                            string namee = name_num;
                            string path  = Server.MapPath("") + "\\file" + "\\" + namee;
                            if (Directory.Exists(path))
                            {
                                Response.Write("<script>alert('文件夹已存在了!');history.go(-1);</script>");
                            }
                            else
                            {
                                DirectoryInfo folder     = Directory.CreateDirectory(path);
                                string        time       = Convert.ToString(Directory.GetCreationTime(path));
                                string        foldername = name.Substring(name.LastIndexOf("\\") + 1);
                                // Response.Write("添加成功!");
                                //Response.Write("添加时间:" + time);
                                //Response.Write("文件夹名:" + foldername);
                            }
                            WebMessageBox.Show("注册成功,欢迎您加入我们!", "index1.aspx");
                        }
                        else
                        {
                            WebMessageBox.Show("注册失败请,检查输入信息!!", "register.aspx");
                            Response.Redirect("register.aspx");
                        }
                        if (conn.State == System.Data.ConnectionState.Open)
                        {
                            conn.Close();
                        }
                    }
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.ClientScript.GetType(), "myscript", "<script>Materialize.toast('验证码不一致!', 3000, 'rounded');</script>");
                }
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String file_yulan_url = "";
        String file_zip_url   = "";
        bool   fileIsValid    = false;

        //如果确认了上传文件,则判断文件类型是否符合要求
        if (this.FileUpload1.HasFile)
        {
            //获取上传文件的后缀
            String   fileExtension     = System.IO.Path.GetExtension(this.FileUpload1.FileName).ToLower();
            String[] restrictExtension = { ".gif", ".jpg", ".bmp", ".png" };
            //判断文件类型是否符合要求
            for (int i = 0; i < restrictExtension.Length; i++)
            {
                if (fileExtension == restrictExtension[i])
                {
                    fileIsValid = true;
                }
            }
            //如果文件类型符合要求,调用SaveAs方法实现上传,并显示相关信息
            if (fileIsValid == true)
            {
                try
                {
                    this.Image1.ImageUrl = "~/file/" + Session["user"].ToString() + "/" + FileUpload1.FileName;
                    //预览文件地址
                    file_yulan_url = Session["user"] + "/" + FileUpload1.FileName;
                    this.FileUpload1.SaveAs(Server.MapPath("~/file/" + Session["user"].ToString() + "/") + FileUpload1.FileName);
                    this.Label1.Text  = "预览文件上传成功";
                    this.Label1.Text += "<Br/>";
                    this.Label1.Text += "<li>" + "原文件路径:" + this.FileUpload1.PostedFile.FileName;
                    this.Label1.Text += "<Br/>";
                    this.Label1.Text += "" + "文件大小:" + this.FileUpload1.PostedFile.ContentLength + "字节";
                    this.Label1.Text += "&nbsp;&nbsp;";
                    this.Label1.Text += "" + "文件类型:" + this.FileUpload1.PostedFile.ContentType;
                }
                catch (Exception ex)
                {
                    this.Label1.Text = "无法上传文件" + ex.Message;
                }
            }
            else
            {
                this.Label1.Text = "上传失败,只能够上传后缀为.gif,.jpg,.bmp,.png的文件";
            }
        }


        //##########################################################################################################


        //如果确认了上传文件,则判断文件类型是否符合要求
        if (this.FileUpload2.HasFile)
        {
            //获取上传文件的后缀
            String   fileExtension     = System.IO.Path.GetExtension(this.FileUpload2.FileName).ToLower();
            String[] restrictExtension = { ".ISO", ".jar", ".rar", ".zip", ".ai", ".cdr", ".cdr" };
            //判断文件类型是否符合要求
            for (int i = 0; i < restrictExtension.Length; i++)
            {
                if (fileExtension == restrictExtension[i])
                {
                    fileIsValid = true;
                }
            }
            //如果文件类型符合要求,调用SaveAs方法实现上传,并显示相关信息
            if (fileIsValid == true)
            {
                try
                {
                    this.Image2.ImageUrl = "~/imag/bg2.png";
                    //源文件地址
                    file_zip_url = Session["user"] + "/" + FileUpload2.FileName;
                    this.FileUpload2.SaveAs(Server.MapPath("~/file/" + Session["user"].ToString() + "/") + FileUpload2.FileName);
                    this.Label2.Text  = "源文件上传成功";
                    this.Label2.Text += "<Br/>";
                    this.Label2.Text += "<li>" + "原文件路径:" + this.FileUpload2.PostedFile.FileName;
                    this.Label2.Text += "<Br/>";
                    this.Label2.Text += "" + "文件大小:" + this.FileUpload2.PostedFile.ContentLength + "字节";
                    this.Label2.Text += "&nbsp;&nbsp;";
                    this.Label2.Text += "" + "文件类型:" + this.FileUpload2.PostedFile.ContentType;
                }
                catch (Exception ex)
                {
                    this.Label2.Text = "无法上传文件" + ex.Message;
                }
            }
            else
            {
                this.Label2.Text = "上传失败,只能够上传后缀为.ai,.cdr.psd,.zip,.rar,.jar,.IOS的文件";
            }
        }


        String use_number = Session["user"].ToString();
        String file_zip   = "源文件名";
        String file_yulan = "预览文件名";
        String jianjie    = "素材简介";
        String type       = "素材文件";


        Datacon       dc   = new Datacon();
        SqlConnection conn = dc.SQL_con();

        if (conn.State == System.Data.ConnectionState.Closed)
        {
            conn.Open();
        }
        string     str  = "insert into [shine_sucai] (use_num,file_zip,file_yulan,file_zip_url,file_yulan_url,jianjie,type) values('" + use_number + "','" + file_zip + "','" + file_yulan + "','" + file_yulan_url + "','" + file_yulan_url + "','" + jianjie + "','" + type + "')";
        SqlCommand comm = new SqlCommand(str, conn);

        if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
        {
            // 在此处放置用户代码以初始化页面

            Response.Write("<script> alert('恭喜 ,上传成功!')</script>");
        }
        else
        {
            Response.Write("<script> alert('抱歉 ,上传失败!')</script>");
        }
        if (conn.State == System.Data.ConnectionState.Open)
        {
            conn.Close();
        }
    }