View Full Version : نمایش نام و نام خانوادگی کاربر
shahram176
یک شنبه 01 دی 1392, 22:37 عصر
سلام من می خوام وقتی کاربری وارد شد نام و نام خانوادگی را که موقع ثبت نام وارد بانک کرده بگیرم و توی label قرار بدم
sami_villa
یک شنبه 01 دی 1392, 22:49 عصر
من از این session استفاده کردم....
توی دکمه لوگین:
protected void btnloginst_Click(object sender, EventArgs e)
{
mysqlconnection con = new mysqlconnection();
var cnn = new SqlConnection(con.constr);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = String.Format("select * from carmand where CAshsh=" + txtuserst.Text + " and CAmelicode=" + txtpassst.Text + "");
cmd.Connection = cnn;
cnn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["CAname"] = dr["CAname"];
Response.Redirect("carmand/indexcarmand.aspx");
}
else
{
Response.Redirect("login.aspx");
}
cnn.Close();
}
و بعد توی پیج لود صفحه ای که باز میشه اینو نوشتم:
protected void Page_Load(object sender, EventArgs e)
{
message.Text = "سلام " + (string)Session["CAname"] + ".خوش آمدید.";
}
Mohammad_dn
یک شنبه 01 دی 1392, 22:49 عصر
SELECT Name, Family FROM UserData WHERE UserName=@UserName
با این دستور میتونی این کارو بکنی
Mohammad_dn
یک شنبه 01 دی 1392, 22:53 عصر
select * from carmand where CAshsh=" + txtuserst.Text + " and CAmelicode=" + txtpassst.Text
این کد یعنی امنیت = 0
و حمله ی xxs
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.