using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//该源码下载自www.51aspx.com(５１ａsｐｘ．ｃｏｍ)

public partial class Member_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Title = "用户登录";
    }
    /// <summary>
    /// 登陆
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void loginsubmit_ServerClick(object sender, ImageClickEventArgs e)
    {
        if (this.checkCokdeTb.Text.Trim() == Session["CheckCode"].ToString())
        {
            BLL.UserInfo user = new BLL.UserInfo();
            if (user.validateUser(this.username.Value.Trim(), this.password.Value.Trim(), 1))
            {
                user.SetCookie(this.username.Value.Trim());
                this.Response.Redirect("Default.aspx");
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('用户名和密码不一致!')</script>", false);
            }
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('验证码错误!')</script>", false);
        }
    }
}
