Hey All,
I got admin user login system in asp.net, but I need the same using php.
Could anyone write me the below code using php?
Note: Don't worry about the database connection, because I already got connected to the database.
Dim memberID, pword As String
memberID = txtUsername.Text
pword = txtPassword.Text
lblError.Text = ""
If memberID = "" Or pword = "" Then
lblError.Text = "Please enter the username/password"
Else
Dim DBConnection As SqlConnection = New SqlConnection()
Dim DBCommand As SqlCommand = New SqlCommand()
Dim SQLString As String
Dim DBConnString As String
Dim sRight As String
DBConnString = ConfigurationManager.ConnectionStrings("MyDbConn2").ConnectionString
DBConnection.ConnectionString = DBConnString
DBCommand.Connection = DBConnection
SQLString = "SELECT Rights FROM member " & _
"WHERE MemberId = '" & memberID & "' " & _
"AND Password = '" & pword & "'"
DBCommand.CommandText = SQLString
DBCommand.CommandType = CommandType.Text
DBCommand.Connection.Open()
sRight = DBCommand.ExecuteScalar()
If Not sRight Is Nothing Then
'Do processing here'
Select Case sRight.ToString().Trim()
Case "administrator"
Response.Redirect("menuadministrator.aspx")
Case "member"
Response.Redirect("menumembers.aspx")
End Select
Else
lblError.Text = "Invalid UserName or Password"
End If
DBConnection.Close()
End If