Index.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:4k
源码类别:
Email客户端
开发平台:
Visual C++
- 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;
- using System.Data.SqlClient; ///引入命名空间
- public partial class IndexFrame_Main : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void btnOK_Click(object sender, EventArgs e)
- {
- if (Request.Cookies["CheckCode"] == null)
- {
- Response.Write("<script language=javascript>alert('您的浏览器设置已被禁用 Cookies,您必须设置浏览器允许使用 Cookies 选项后才能使用本系统。')</script>");
- return;
- }
- if (this.CheckBox1.Checked)
- {
- if (String.Compare(Request.Cookies["CheckCode"].Value, txtCheckCode.Text.ToUpper(), true) != 0)
- {
- Response.Write("<script language=javascript>alert('验证码错误,请重新输入!')</script>");
- return;
- }
- else
- {
- SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]);
- Con.Open();
- SqlCommand Com = new SqlCommand("select * from tb_User where UserName='" + this.txtName.Text + "' and PassWord='" + this.txtPwd.Text + "' and Popedom='0'", Con);
- SqlDataReader dr = Com.ExecuteReader();
- dr.Read();
- if (dr.HasRows)
- {
- Session["UserName"] = dr["UserName"].ToString();
- Session["Name"] = dr["Name"].ToString();
- Session["PassWord"] = dr["PassWord"].ToString();
- Session["Popedom"] = dr["Popedom"].ToString();
- Session.Timeout = 100;
- string cmdtxt = "INSERT INTO tb_LoginLog(UserName,LoginTime,LoginIP)";
- cmdtxt += " VALUES('" + dr["UserName"].ToString() + "','" + DateTime.Now + "','" + Request.UserHostAddress + "')";
- SqlData da = new SqlData();
- da.ExceSQL(cmdtxt);
- Response.Redirect("Module/Index.aspx");
- }
- else
- {
- Response.Write("<script language=javascript>alert('用户名或密码不正确!');</script>");
- }
- dr.Close();
- }
- }
- else
- {
- if (String.Compare(Request.Cookies["CheckCode"].Value, txtCheckCode.Text.ToUpper(), true) != 0)
- {
- Response.Write("<script language=javascript>alert('验证码错误,请重新输入!')</script>");
- return;
- }
- else
- {
- SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["ConSQL"]);
- Con.Open();
- SqlCommand Com = new SqlCommand("select * from tb_User where UserName='" + this.txtName.Text + "' and PassWord='" + this.txtPwd.Text + "' and Popedom='1'", Con);
- SqlDataReader dr = Com.ExecuteReader();
- dr.Read();
- if (dr.HasRows)
- {
- Session["UserName"] = dr["UserName"].ToString();
- Session["Name"] = dr["Name"].ToString();
- Session["PassWord"] = dr["PassWord"].ToString();
- Session["Popedom"] = dr["Popedom"].ToString();
- string cmdtxt = "INSERT INTO tb_LoginLog(UserName,LoginTime,LoginIP)";
- cmdtxt += " VALUES('" + dr["UserName"].ToString() + "','" + DateTime.Now + "','" + Request.UserHostAddress + "')";
- SqlData da = new SqlData();
- da.ExceSQL(cmdtxt);
- Response.Redirect("Module/Index.aspx");
- }
- else
- {
- Response.Write("<script language=javascript>alert('用户名或密码不正确!');</script>");
- }
- dr.Close();
- }
- }
- }
- }