Jump to content

if the user not exsite >> Invalide Login


Matar

Recommended Posts

i witre the following code , this code is login code ,so when the user enter the user name correctly he will go to his information , the problem is when entering a invlaide user name , he go to the same page but with no information , i need to code ,thats redirect the user to anthor page :this is the code ::***<html><body><center> <table width="30%" cellspacing="0" cellpadding="2" border="1" > <tr> <th bgcolor = "yellow">name</th> <th bgcolor = "yellow">age</th> <th bgcolor = "yellow">address</th> </tr><%Dim conn Dim rs 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 user = '" & Request.Form("name") & "'"set RS = Conn.Execute(SQL)DO While NOT RS.EOF response.write("<td>" & rs.fields("name") & "</td>") & "<BR>" response.write("<td>" & rs.fields("age") & "</td>") & "<BR>" response.write("<td>" & rs.fields("address") & "</td>") & "<BR>" RS.MoveNextLoop RS.CloseSet RS = nothingConn.CloseSet Conn = nothing%></center></body></html> :)

Link to comment
Share on other sites

try this code. check out the code below (your code with small changes marked in bold)<html><body><center><table width="30%" cellspacing="0" cellpadding="2" border="1" ><tr><th bgcolor = "yellow">name</th><th bgcolor = "yellow">age</th><th bgcolor = "yellow">address</th></tr><%Dim conn Dim rs 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 user = '" & Request.Form("name") & "'"set RS = Conn.Execute(SQL)IF NOT RS.EOF THENresponse.write("<td>" & rs.fields("name") & "</td>") & "<BR>"response.write("<td>" & rs.fields("age") & "</td>") & "<BR>"response.write("<td>" & rs.fields("address") & "</td>") & "<BR>"RS.MoveNextLoopELSEResponse.Redirect "loginFalied.asp"END IFRS.CloseSet RS = nothingConn.CloseSet Conn = nothing%></center></body></html>

Link to comment
Share on other sites

thank u for ur help , i want to ask you about post html form value to access DB , i am trying that , and its wok propably with <input = "text"> when i need to post the <input="radio" or "checkbox"> i have the following error "type mismatch" ,and i check the db feild thats it yes or no value , if u can help me , please write a simple code thank u :)

Link to comment
Share on other sites

Hi, you have to check the datatype for the field in the DB in which you will insert the value from the form..In general it s going to be like this<input type="radio" name = "test" value = "1"> The value from the VALUE attribute will be got when you do a POST. So make sure that the value and the datatype in the DB match.HTH

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
×
×
  • Create New...