出来丢个人
if(this.TextBox1.Text.Trim()=="")
{
Response.Write("<script>alert('请输入用户名。');</script>");
return;
}
if(this.TextBox2.Text=="")
{
Response.Write("<script>alert('请输入密码。');</script>");
return;
}
string sql="select * from userinfo where name='"+this.TextBox1.Text.Trim()+"'";
db DB=new db();
if(DB.ConnDb(sql).Tables[0].Rows.Count<1)
{
Response.Write("<script>alert('用户名不存在。');</script>");
return;
}
if(DB.ConnDb(sql).Tables[0].Rows[0]["Password"].ToString()!=this.TextBox2.Text)
{
Response.Write("<script>alert('密码错误。');</script>");
return;
}
else
{
Session["user"]=this.TextBox1.Text.Trim();
string sql1="update userinfo set Entertime='"+System.DateTime.Now+"' where name ='"+Session["user"]+"'";
db DB1=new db();
DB1.AlterDb(sql1);
IfAdmin ia=new IfAdmin();
if(ia.Isadmin(Session["user"].ToString())==1)
{
Response.Redirect("admin/userinfo.aspx");
}
else
Response.Redirect("user/bbs.aspx");
}