Ejemplo n.º 1
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        string email = Server.HtmlEncode(Request["logname"]);
        string pwd   = Server.HtmlEncode(Request["logpass"]);

        Model.user mod = new Model.user();
        mod.email = email;
        mod.pwd   = pwd;

        BLL.user      bll = new BLL.user();
        SqlDataReader dr  = bll.login(mod);

        //ds.Tables[0].Rows[0]["_user_id"];
        if (true)
        {
            SqlDataReader dr1 = bll.lo(mod);
            if (dr1.Read())
            {
                Session["_user_name"] = dr1["_user_name"].ToString();
                Session["_user_id"]   = dr1["_user_id"].ToString();

                dr1.Close();
            }
            dr1.Close();
        }
        else
        {
            Session["_user_name"] = "";
        }

        if (true)
        {
            if (true)
            {
                if (dr.Read())
                {
                    Response.Redirect("index.aspx");



                    Model.user mol = new Model.user();
                    mol.userid = Convert.ToInt32(Session["_user_id"]);

                    BLL.user      bllu = new BLL.user();
                    int           r    = bllu.update(mol);
                    SqlDataReader dr2  = bll.lo(mod);
                    if (dr2.Read())
                    {
                        Session["_user_name"] = dr2["_user_name"].ToString();
                        Session["_user_id"]   = dr2["_user_id"].ToString();
                        dr2.Close();
                    }
                    dr2.Close();
                }

                else
                {
                    Common.MessageAlert.Alert(Page, "登入失败!");
                }
            }
        }
    }
Ejemplo n.º 2
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        string email = Server.HtmlEncode(TextBox3.Text);
        string pwd   = Server.HtmlEncode(TextBox4.Text);

        Model.user mod = new Model.user();
        mod.email = email;
        mod.pwd   = pwd;

        BLL.user      bll = new BLL.user();
        SqlDataReader dr  = bll.login(mod);

        if (CheckBox1.Checked)
        {
            SqlDataReader dr1 = bll.lo(mod);
            if (dr1.Read())
            {
                Session["_username"] = dr1["_username"].ToString();
                Session["_userid"]   = dr1["_userid"].ToString();

                dr1.Close();
            }
            dr1.Close();
        }
        else
        {
            Session["_username"] = "";
        }

        if (Session["CheckCode"] != null)
        {
            if (TextBox1.Text.ToLower() == Session["CheckCode"].ToString().ToLower())
            {
                if (dr.Read())
                {
                    Response.Redirect("ACIndex.aspx");



                    Model.user mol = new Model.user();
                    mol.userid = Convert.ToInt32(Session["_userid"]);

                    BLL.user      bllu = new BLL.user();
                    int           r    = bllu.loginLastTime(mol);
                    SqlDataReader dr2  = bll.lo(mod);
                    if (dr2.Read())
                    {
                        Session["_username"] = dr2["_username"].ToString();
                        Session["_userid"]   = dr2["_userid"].ToString();
                        dr2.Close();
                    }
                    dr2.Close();
                }

                else
                {
                    Common.MessageAlert.Alert(Page, "账号或密码错误,登入失败!");
                }
            }
            else
            {
                Common.MessageAlert.Alert(Page, "验证码错误!");
            }
        }
    }