示例#1
0
 protected void ImgBtnLogin_Click(object sender, ImageClickEventArgs e)
 {
     if (this.TxtUserName.Text == string.Empty)
     {
         Response.Write("<script language=javascript>alert('用户名不能为空!');location='UserLogin.aspx'</script>");
         return;
     }
     else
     {
         if (this.TxtCode.Text == Request.Cookies["CheckCode"].Value)
         {
             string SqlStr = "select count(*) from tb_UserLogin where UserName='******'and UserPwd='" + this.TxtUserPwd.Text + "'";
             int    a      = ep.EXECuteScalar(SqlStr);
             if (a >= 1)
             {
                 Session["UserName"] = this.TxtUserName.Text;
                 Session["UserPwd"]  = this.TxtUserPwd.Text;
                 Response.Write("<script lanuage='javaScript'>alert('恭喜您!!登录成功!');location='Default.aspx'</script>");//弹出对话框显示“恭喜您!!登录成功!”,并且跳转到网站首页中
             }
             else
             {
                 Response.Write("<script lanuage='javaScript'>alert('很遗憾!!登录失败!');location='UserLogin.aspx'</script>");//弹出对话框显示“很遗憾!!登录失败!”
             }
         }
         else
         {
             Response.Write("<script language=javascript>alert('输入的验证码不正确!');location='UserLogin.aspx'</script>");
         }
     }
 }
示例#2
0
 protected void BtnCheck_Click(object sender, EventArgs e)
 {
     if (this.Txtid.Text == "")
     {
         Response.Write("<script lanuage='javaScript'>alert('新闻编号不能为空!');location='AdminNew_Add.aspx'</script>");
     }
     else
     {
         string SqlStr = "select count(*) from tb_New where id='" + this.Txtid.Text + "'";
         int    a      = ep.EXECuteScalar(SqlStr);
         if (a >= 1)
         {
             //弹出对话框显示“新闻编号已存在,请在添加一个!”
             Response.Write("<script lanuage='javaScript'>alert('新闻编号已存在,请在添加一个!');location='AdminNew_Add.aspx'</script>");
         }
         else
         {
             //弹出对话框显示“新闻编号不存在,你可以继续添加其他信息!”
             Response.Write("<script lanuage='javaScript'>alert('新闻编号不存在,你可以继续添加其他信息!');location='AdminNew_Add.aspx'</script>");
         }
     }
 }