By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,334 Members | 2,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,334 IT Pros & Developers. It's quick & easy.

VB ASP form

P: 35
Hey,

I have been working on creating a basic login for a website now for 2 days and still have gotten no further.

So far I think the form is correct, it has to fields a username and a password field, this then gets submitted to the check.asp via the post method then the vb script is meant to link to the sql database and validate if the login information is present in the database. If it is redirect to welcome.asp, else goto login.asp

Here's what I have so far

login.asp

Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3. <head>
  4. <title>login</title>
  5. </head>
  6.  
  7. <body>
  8. <form action="check.asp" method="post" name="login">
  9.     <table>
  10.     <tr>
  11.     <td><span class="style14">Username:</span> </td>
  12.     <td><input name="username" type="text" size="30" maxlength="25" /></td>
  13.     </tr>
  14.     <tr>
  15.     <td><span class="style14">Password:</span></td>
  16.     <td><input name="password" type="password" size="30" maxlength="25" /></td>
  17.     </tr>
  18.     <tr>
  19.     <td><div align="left"><a href="register.asp" class="style13">Sign up....  </a></div></td>
  20.     <td align=right><input type="image" src="submit.jpg" alt="loginsubmit"/></td>
  21.     </tr>
  22.     </table>   
  23.     </form>
  24. </body>
  25. </html>
  26.  
check.asp

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%
  3. '#Connect to SQL database#'
  4. Dim objConn
  5. Set objConn = Server.CreateObject("ADODB.Connection")
  6. objConn.Open "dsn=Oracle;uid=username;pwd=password;"
  7. %>
  8.  
  9. <%
  10. intUserid = Request.form("intUserid")
  11. txtUserpwd = Request.form("txtUserpwd")
  12. %>
  13. <%
  14. strSQL = "SELECT * FROM tblUser WHERE intUserid = '"&intUserid&"' AND txtUserpwd = '"&txtUserpwd&"'"
  15.  
  16. Set objRs = objConn.execute(strSQL)
  17.  
  18. If (objRs.BOF) then 
  19. Response.Redirect "login.asp?fail try again"
  20. Else 
  21. Response.Cookies("login")("intUserid") = intUserid
  22. Response.Cookies("login").Expires = Date + 1
  23. Response.Redirect "welcome.asp"
  24.  
  25. End If
  26. %>
  27.  
Any ideas guys?
Jan 22 '08 #1
Share this Question
Share on Google+
3 Replies


daniel aristidou
100+
P: 491
Hey,

I have been working on creating a basic login for a website now for 2 days and still have gotten no further.

So far I think the form is correct, it has to fields a username and a password field, this then gets submitted to the check.asp via the post method then the vb script is meant to link to the sql database and validate if the login information is present in the database. If it is redirect to welcome.asp, else goto login.asp

Here's what I have so far

Any ideas guys?
What exactly do you want help with?
Jan 31 '08 #2

P: 35
What exactly do you want help with?
its ok came up with a solution, cheers though
Jan 31 '08 #3

P: 1
its ok came up with a solution, cheers though
What was your solution?
Feb 8 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.