Jump to content

check user name and user password


Matar
 Share

Recommended Posts

Have a read of the ADO tutorial pages. You'll need to learn how to connect to the database, and then how to query it with SQL to test whether theres and entry in the table with the username and password. If you haven't already you'll also want to look at the ASP tutorials to see how to retrieve the username and password that were entered on the form.Have a go, then if you get stuck post a question requesting help.

Link to comment
Share on other sites

hi thank you for your replay i very well in asp and ado , i can connect the database and store data in database by html form via asp , and i can show the contant of the database on web pagi have the SQL Statment To reteve The Data for example Select* where name = 'Joe' and pass = '596' look , here i define the user name and password , i dont need this i need Checking on user name & password entered In Html form . Thank YOU.

Link to comment
Share on other sites

Is this what you are looking for..,ASP:<% dim uname, pwd,sqluname=request.form("login")pwd=request.form("pass")'Query to check if username and pwd vaildsql = "SELECT * FROM tblname WHERE (fldUSERNAME ='" & uname & "') AND (fldUSERNAME ='" & pwd & "')"Set RS = MyConn.Execute(SQL)if rs.EOF then'Invalid userElse'valid user...... %>HTML:<form action="test.asp" method="post"><inupt name="login"...........><inupt name="pass"...........>

Link to comment
Share on other sites

hi thank you man for your reply i was trying the code that you write , but when i run the page , there is nothingto show in the page , the result is clear page . this the code ***********<html><body><%Dim conn Dim rs Dim strdim namedim passname = request.form("name")pass = request.form("pass")Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/it.mdb"))set rs = Server.CreateObject("ADODB.recordset") sql= "SELECT * FROM samer WHERE (name ='" & uname & "') AND (pass ='" & pwd & "')" set RS = Conn.Execute(SQL)DO While NOT RS.EOF Response.Write RS("age") & "<BR>" Response.Write RS("address") & "<BR>" RS.MoveNextLoop RS.CloseSet RS = nothingConn.CloseSet Conn = nothing%></body></html>*****html code :<html><head><title>test</title></head><body bgcolor="white" text="black"> <form name="form" method="post" action="log.asp"> Name: <input type="text" name="name" > <br> Comments: <input type="password" name="pass"><br> <input type="submit" name="Submit" value="Submit"> </form> </body></html>*****i dont use ODBC Setting To Connect My Database With ASP . What Is The Problem .

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...

Error is in that 15 line. Because he use variable pwd in his SQL command, and value of password field is stored in variable pass.Right SQL statement would be:sql= "SELECT * FROM samer WHERE (name ='" & uname & "') AND (pass ='" & pass & "')"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...