| | |
login
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
i ahve database in which i hava login information iwa nted to check weather the persons login information is correct or wrong.
i m very new to asp. so any body help how i have to proceed
<%dim user,pass
user=request.form("usercode")
pass=request.form("pass")
response.write(user)
response.write(pass)
' Open database
Dim Conn, RS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user
; pwd=pass option=3;"
Set RS = Conn.Execute("SELECT * From userss where username='user' and password='pass'")
if RS="user" then
response.write("login")
end if
%>
i m trying some how like this but getting error. i think i dont know how to check the login information with database .pls help
i m very new to asp. so any body help how i have to proceed
<%dim user,pass
user=request.form("usercode")
pass=request.form("pass")
response.write(user)
response.write(pass)
' Open database
Dim Conn, RS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user
; pwd=pass option=3;"
Set RS = Conn.Execute("SELECT * From userss where username='user' and password='pass'")
if RS="user" then
response.write("login")
end if
%>
i m trying some how like this but getting error. i think i dont know how to check the login information with database .pls help
•
•
Join Date: Sep 2004
Posts: 89
Reputation:
Solved Threads: 1
here is the code that can help you in designing the login page for the users. It is well commented so I think you will have no problem in understanding that.
ASP Syntax (Toggle Plain Text)
<% Dim adoConn 'Database Connection Variable Dim rsCheckUser 'Database Recordset Variable Dim strSQL 'Database query sring Dim strUserName 'Holds the user name Dim strPassword 'Holds the Password 'Initalise the strUserName variable strUserName = Request.Form("UserName") strPassword = Request.Form("Passowrd") 'Create a connection odject Set adoConn = Server.CreateObject("ADODB.Connection") adoConn.Open "Driver={MySql ODBC 3.51 Driver}; Server=localhost; database=slogin; uid=user 'Create a recordset object Set rsCheckUser = Server.CreateObject("ADODB.Recordset") 'Initalise the strSQL variable with an SQL statement to query the database strSQL = "SELECT UserName, Password FROM tblUsers WHERE UserName ='" & strUserName & "'" 'Query the database rsCheckUser.Open strSQL, adoConn 'If the recordset finds a record for the username entered then read in the password for the user If NOT rsCheckUser.EOF Then 'Read in the password for the user from the database If (strPassword) = rsCheckUser("Password") Then 'If the password is correct then set the session variable to True Session("LoggedIn") = True 'Close Objects before redirecting Set adoCon = Nothing Set strCon = Nothing Set rsCheckUser = Nothing 'Redirect to the authorised user page and send the users name Response.Redirect "loggedin.asp" End If End If 'Close Objects Set adoCon = Nothing Set strCon = Nothing Set rsCheckUser = Nothing 'If the script is still running then the user must not be authorised Session("LoggedIn") = False 'Redirect to the unautorised user page Response.Redirect "login.asp" %>
![]() |
Similar Threads
- Windows XP slow login (Windows NT / 2000 / XP)
- network login problem (Windows NT / 2000 / XP)
- can't get past xp login (Windows NT / 2000 / XP)
- XP anf Novell Client Dual Login (Novell)
- Cannot Login to Mac (OS X)
- login screen config (Window and Desktop Managers)
Other Threads in the ASP Forum
- Previous Thread: How to specify a port number
- Next Thread: SQL Query inserts junk data as well
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





