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 xuexi_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ImageButton1.ImageUrl = "../image.aspx";
}
protected void Button1_Click1(object sender, EventArgs e)
{
string user_name, user_pwd,con_str,sql_str;
if (Request.Form.Get("T_yz").ToString() == Session["yanzheng"].ToString())
{
user_name = Request.Form.Get("T_name");
user_pwd = Request.Form.Get("T_pwd");
//con_str = ConfigurationSettings.AppSettings["SQL_dsn"];
sql_str = "select [user_name],user_pwd,user_jibie from user_table where [user_name] = '" + user_name + "' and user_pwd ='" + user_pwd+ "'";
SqlConnection scon = new SqlConnection(ConfigurationSettings.AppSettings["SQL_dsn"]);
scon.Open();
SqlCommand scmd = new SqlCommand(sql_str,scon);
SqlDataReader sdr = scmd.ExecuteReader();
if (sdr.Read())
{
Response.Write("欢迎:"+sdr.GetSqlString(0)+"<br>");
Response.Write("级别:"+sdr.GetSqlInt32(2));
if (sdr.GetSqlInt32(2) == 1)
{
Response.Write("<br>您是管理员<br>");
}
else
{
Response.Write("<br>普通会员<br>");
}
}
else
{
Response.Write("密码或者帐号错误");
}
sdr.Close();
scon.Close();
}
else
{
Response.Write("<script>alert('正确输入验证码');</script>");
}
}
}