<%@ Language = "VBScript" %> <% Option Explicit '********************************************************** ' To make this script work you simply need to create a ' table named tblLoginInfo in your database with one ' column named username and another named password. Put ' the values you want for username and password into a ' record in the table. The advantages of this script are ' that it's more secure than if you hard-coded the ' username/password values directly in the script, and ' that you can change the username and password simply by ' changing the values in your login_table. ' ' NOTE: BE SURE TO EITHER MOVE THE INCLUDED SAMPLE ' DATABASE TO A SECURE AREA OUTSIDE THE WEB SITE OR ' USE A DIFFERENT SECURE DATABASE. OTHERWISE ANYONE ' CAN SIMPLY DOWNLOAD THE WHOLE DB AND RETREIVE YOUR ' USERNAME AND PASSWORD FROM IT. '********************************************************** Dim cnnLogin Dim rstLogin Dim strSQL %> Zerion Group, LLC
<% If Request.Form("action") <> "validate_login" Then %>

 

 

Zerion Group Employee Login

Username:
Password:
<% Else strSQL = "SELECT * FROM tblLoginInfo " _ & "WHERE username='" & Replace(Request.Form("login"), "'", "''") & "' " _ & "AND password='" & Replace(Request.Form("password"), "'", "''") & "';" Set cnnLogin = Server.CreateObject("ADODB.Connection") cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _ & "DBQ=" & Server.MapPath("DB/login.mdb")) Set rstLogin = cnnLogin.Execute(strSQL) If Not rstLogin.EOF Then session("validated")="validatedUser" session.Timeout=120 response.Redirect("intranet08.asp") Else %>

Login Failed - Please verify username and password.

Try Again

<% 'Response.End End If ' Clean Up rstLogin.Close Set rstLogin = Nothing cnnLogin.Close Set cnnLogin = Nothing End If %>