Very New, Newbie Confused

W

Wizard

Hello All,

I`ve started learning ASP.Net and web design.

I`ve download the Web Matixs Software but im very confused with something
that i think is so simple. Here goes i`ve downloaded some example ASP code
from the net, As below.

How do i intergrate this into my web page? the code below is for a simple
Username/Password thinggy.

Many Thanks

Regards
Si

<%@ 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 strUsername, strPassword
Dim strSQL

%>
<html>
<head><title>Login Page</title>
</head>
<body bgcolor="gray">
<%
If Request.Form("action") <> "validate_login" Then
%>
<form action="login_db.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" name="login" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"></TD>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>
<%
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("login.mdb"))

Set rstLogin = cnnLogin.Execute(strSQL)

If Not rstLogin.EOF Then
%>
<p>
<strong>All the Good Stuff We Want to Hide</strong>
</p>
<%
Else
%>
<p>
<font size="4" face="arial,helvetica"><strong>
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="login_db.asp">Try Again</a>
</p>
<%
'Response.End
End If

' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing
End If
%>
</body>
</html>
 
D

Daniel Fisher\(lennybacon\)

The line "<%@ Language = "VBScript" %>" indicates Classic ASP (Version 3.0).
Use code with <%@ Language = "VB" %> - that is ASP.NET VisualBasic .NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top