Public Class About
Inherits System.Web.UI.Page
Dim conn As New dbConn
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.lblStatus.Visible = False
End Sub
Protected Sub BtnSumbit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BtnSumbit.Click
Dim intNumRows As Integer
intNumRows = conn.ExecuteScalar("SELECT COUNT(*) FROM Account WHERE username = '" & Me.TxtUsername.Text & "' AND [password] = '" & Me.TxtPassword.Text & "' ")
If intNumRows > 0 Then
Dim CusID As String = ""
CusID = conn.GetDataTable("SELECT UserID FROM Account WHERE username = '" & Me.TxtUsername.Text & "' AND [password] = '" & Me.TxtPassword.Text & "' ", "Customer").Rows(0)(0).ToString()
Session("strUserID") = ""
Session("strUserID") = CusID
If Request.QueryString("r") <> "" Then
Response.Redirect(Request.QueryString("r").ToString())
Else
Response.Redirect("/Profile.aspx")
End If
Else
Me.pnlLogin.Visible = False
Me.lblStatus.Visible = True
Me.lblStatus.Text = "Username/Password ไม่ถูกต้อง.<a href=login.aspx>ลองใหม่อีกครั้ง</a>"
End If
End Sub
End Class