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
check.asp
Any ideas guys?
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
Code:
<html> <head> <title>login</title> </head> <body> <form action="check.asp" method="post" name="login"> <table> <tr> <td><span class="style14">Username:</span> </td> <td><input name="username" type="text" size="30" maxlength="25" /></td> </tr> <tr> <td><span class="style14">Password:</span></td> <td><input name="password" type="password" size="30" maxlength="25" /></td> </tr> <tr> <td><div align="left"><a href="register.asp" class="style13">Sign up.... </a></div></td> <td align=right><input type="image" src="submit.jpg" alt="loginsubmit"/></td> </tr> </table> </form> </body> </html>
Code:
<% '#Connect to SQL database#' Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "dsn=Oracle;uid=username;pwd=password;" %> <% intUserid = Request.form("intUserid") txtUserpwd = Request.form("txtUserpwd") %> <% strSQL = "SELECT * FROM tblUser WHERE intUserid = '"&intUserid&"' AND txtUserpwd = '"&txtUserpwd&"'" Set objRs = objConn.execute(strSQL) If (objRs.BOF) then Response.Redirect "login.asp?fail try again" Else Response.Cookies("login")("intUserid") = intUserid Response.Cookies("login").Expires = Date + 1 Response.Redirect "welcome.asp" End If %>
Comment