Jump to content

babychicken

Members
  • Posts

    2
  • Joined

  • Last visited

babychicken's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. <%sub focus(frm,txtbox) frm.txtbox.focusend sub%><html> <body> <% hid = request.querystring("hid") user = request.querystring("username") pass = request.querystring("password") 'The first time if ( hid <> "test" ) then %> <form action = "test.asp" method = "get" name = "login"> <table border = 0> <tr> <td> username : </td> <% 'username's right but password's wrong if ( user <> "" ) then %> <td> <input type = "text" name = "username" value = <%=user%> > </td> <% 'The first time else %> <td> <input type = "text" name = "username"> </td> <% focus(login,username) end if %> </tr> <tr> <td> password : </td> <td> <input type = "password" name = "password"> </td> <% %> </tr> <tr> <td> <input type = "submit" value = "Log in"> </td> </tr> <% if ( pass = "wrong password" ) then response.write("<br>" & pass) focus(login,password) end if %> <tr> <input type = "hidden" name = "hid" value = "test"> </tr> </table> </form> <% else strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" strDSN = strDSN & server.MapPath("dbuser.mdb") set conn = server.CreateObject("ADODB.Connection") conn.Open strDSN user = request.querystring("username") pass = request.querystring("password") Set rs = server.CreateObject("ADODB.Recordset") strSQL = "Select * from userinfo where username ='" & user & "'" rs.open strSQL , conn response.write(strSQL) 'Redirect to Register page if rs.BOF then Response.Write "Khong ton tai User" 'Response.redirect("Register.asp") else 'username's right but password's wrong if ( rs("password") <> pass ) then Response.Redirect("test.asp?username='" & user & "' & password='wrong password'") 'response.redirect("test.asp") else 'Login succeeded Response.Write(" <br> Hello " & rs("UserName") &" !!!") end if end if end if 'Close rs.close conn.close %> </body></html> I am creating a login page , if user type wrong password , it will redirect to itself . After that focus at password textbox and output to screen "wrong password" . But when i pass value with querystring , i just get value username and pass ( pass = request.querystring("password") ) is always equal "" . So that i can't focus at password textbox . Anybody help me ? . Thank first
  2. when user typed wrong password and i want to redirect to login page but focus at password textbox . I don't know a lot of asp syntax , so that can u some me where i can learn asp syntax ? ( w3school asp tutorial just have a little )
×
×
  • Create New...