Sub Session_OnStart ... Session("bolAuthenticated") = False ... End Sub If Session("bolAuthenticated") = False Then Response.Redirect "/authenticate.asp?" & Request.ServerVariables("SCRIPT_NAME") End If <% 'Get the URL from the querystring Dim URL URL = Request.QueryString %>
User Name: Password:
<% 'Read in the password and username from the form Dim strUserName, strPassword strUserName = Request.form("txtName") strPassword = Request.form("txtPassword") 'Establish a database connection... 'Run your SQL query Dim strSQL strSQL = "SELECT * FROM ValidUsers WHERE UserName = " & _ strUserName & " AND Password = " & _ strPassword 'Run the query... (Conn is the name of the database connection) Dim rs Set rs = Conn.Execute(strSQL) 'If the recordset is not empty, the user is validated If Not rs.EOF Then 'We need to set bolAuthenticated as True! Session("bolAuthenticated") = True 'Send the user to the URL they came from Response.Redirect Request.form("http://users1.50megs.com/3dcockfight/index2.html") Else 'The user was not validated... 'Take them to a page which tells them they were not validated... Response.Redirect "/notvalidated.asp End If %>