Esempio n. 1
0
    /// <summary>
    /// 验证密码
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btEnter_Click(object sender, EventArgs e)
    {
        string pass = TextBox1.Text.Trim();
        string name = Session["adminName"].ToString();

        pass = common.md5(pass);

        dbConfig db = new dbConfig();
        DataSet ds = db.getUsers(User.Identity.Name);

        bool isAdmin = false;

        if (ds != null && ds.Tables.Count > 0)
        {
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if ( row[2].ToString() == pass && row[1].ToString()==name )
                {
                    isAdmin = true;
                    this.divImport.Visible = true;
                    this.passDiv.Visible = false;
                    break;
                }
            }
        }

        if (!isAdmin)
        {
            ltMsg.Text = "<script>alert('对不起,管理员密码不正确');</script>";
            return;
        }

        Session["passd"] = common.md5(TextBox1.Text.Trim());

        initForm();

        //Response.Redirect("importFileForBlack.aspx?type=" + this.hdType.Value);

        //ltMsg.Text = "<script>javascript:window.close();</script>";
    }