Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            AllinOrder AllinOrder1 = new AllinOrder();
            GetRequest GetRequest1 = new GetRequest();

            string u = GetRequest1.GetRequestCookies("user_id", "0");

            if (u == "0")
            {

            }
            else
            {
                if (AllinOrder1.GetOrderTry(u) == "success")
                {
                    Response.Redirect("tryalready.aspx");
                }
                else
                {
                    AllinOrder1.SetOrderTry(u);
                    Response.Redirect("trysuccess.aspx");
                }

            }
        }
    }
Example #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        check ck = new check();
        string username = ck.CheckInput(txtUsername.Value);
        string password = ck.CheckInput(txtPassword.Value);
        string autologin = "******";

        if (chkAutoLogin.Checked == true)
        {
            autologin = "******";
        }
        else
        {
            autologin = "******";
        }

        if (username == "" && password == "")
        {
            MessageBox("opfail", "未填写用户名和密码");
        }
        else
        {
            if (username == "")
            {
                MessageBox("opfail", "未填写用户名");
            }
            if (password == "")
            {
                MessageBox("opfail", "未填写密码");
            }
        }

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        string sql = "";

        sql = sql + "SELECT ";
        sql = sql + "UserID,UserName,ifvip,ifmanage ";
        sql = sql + "FROM ";
        sql = sql + "TB_User ";
        sql = sql + "WHERE ";
        sql = sql + "UserName = '******' ";
        sql = sql + "AND UserPassword = '******' ";

        ds = cn.mdb_ds(sql, "user");

        if (ds.Tables["user"].Rows.Count > 0)
        {
            string userid = ds.Tables["user"].Rows[0][0].ToString();
            string usernm = ds.Tables["user"].Rows[0][1].ToString();
            string ifvip = ds.Tables["user"].Rows[0]["ifvip"].ToString();
            string ifmanage = ds.Tables["user"].Rows[0]["ifmanage"].ToString();

            Response.Cookies["user_id"].Value = userid;
            Response.Cookies["user_name"].Value = Server.UrlEncode(usernm);
            Response.Cookies["user_password"].Value = password;
            Response.Cookies["ifvip"].Value = ifvip;
            Response.Cookies["ifmanage"].Value = ifmanage;

            if (autologin == "1")
            {
                Response.Cookies["user_id"].Expires = DateTime.Now.AddDays(365);
                Response.Cookies["user_name"].Expires = DateTime.Now.AddDays(365);
                Response.Cookies["user_password"].Expires = DateTime.Now.AddDays(365);
                Response.Cookies["ifvip"].Expires = DateTime.Now.AddDays(365);
                Response.Cookies["ifmanage"].Expires = DateTime.Now.AddDays(365);
            }

            AllinOrder AllinOrder1 = new AllinOrder();
            GetRequest GetRequest1 = new GetRequest();

            string u = GetRequest1.GetRequestCookies("user_id", "0");

            if (AllinOrder1.GetOrderTry(u) == "success")
            {
                Response.Redirect("tryalready.aspx");
            }
            else
            {
                AllinOrder1.SetOrderTry(u);
                Response.Redirect("trysuccess.aspx");
            }

        }
        else
        {
            MessageBox("opfail", "用户名或密码填写错误");
        }
    }