using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using System.Web.Configuration; using System.Text; public partial class UI_WebUserControl2 : System.Web.UI.UserControl { string strConnString = WebConfigurationManager.ConnectionStrings["DB_regSystemConnection"].ConnectionString; SqlConnection aConnection = new SqlConnection(); SqlCommand aCommand = new SqlCommand(); string sqlStatement; protected void Page_Load(object sender, EventArgs e) { btnOut.Visible = false; lblName.Visible = false; lblUser.Visible = false; } public void MessageBox(string msg) { Label lbl = new Label(); lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "')</script>"; Page.Controls.Add(lbl); } protected void BtnOK_Click(object sender, ImageClickEventArgs e) { aConnection.ConnectionString = strConnString; aConnection.Open(); int intNumRows = 0; sqlStatement = "SELECT COUNT(*) FROM Staff WHERE Staff_ID = '" + this.tbxNameLog.Text + "'AND password = '" + this.tbxPass.Text + "' "; aCommand = new SqlCommand(sqlStatement, aConnection); intNumRows = Convert.ToInt32(aCommand.ExecuteScalar()); if (intNumRows > 0) { Session["strUser"] = this.tbxNameLog.Text; Response.Redirect("updateStaff.aspx"); lblUsername.Visible = false; tbxNameLog.Visible = false; lblPassword.Visible = false; tbxPass.Visible = false; // lblUser.Text = Session["strUser"].ToString; } else { this.lblUsername.Visible = true; MessageBox("Username/Password ไม่ถูกต้อง"); ClearDataControl(); //this.lblUsername.Text = "Username/Password is wrong."; } aConnection.Close(); aConnection = null; } private void ClearDataControl() { tbxNameLog.Text = ""; tbxPass.Text = ""; } protected void btnOut_Click(object sender, ImageClickEventArgs e) { Session.Clear(); Response.Redirect("Default.aspx"); } }
<? include_once("connect.php"); $sql = "select * from login where logname='$logname' and pw='$pw' "; $dbquery = mysql_db_query($dbname, $sql); $result = mysql_fetch_array($dbquery); $username = $result[username]; $num_rows = mysql_num_rows($dbquery); if($num_rows==1) { $_SESSION['namelog'] = "$username"; } else { echo "Username หรือ Password ไม่ถูกต้อง"; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง