PDA

Click to See Complete Forum and Search --> : Username/password logon


Skeen
Aug 21st, 2000, 03:25 AM
Hi Y'all

I'm trying to logon to a database using VBscript inside html. The problem I'm having is that the username and password I input at the html screen is not being inserted into the VBscript.
Secondly the reconciliation between the stored username and password fom the database, and the values input dosn't seem to happen.
If anyone can see what wrong with my code I'd appreciate the help. My code is below:

Cheers 'n' beers<html>

<head>




<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Acquist Accounts</title>
</head>

<script language = "vbscript">

function Get_Username
Dim AcqAcc

On Error Resume Next
' create the connection object
Set AcqAcc = CreateObject ( "ADODB.Connection" )

' Set the connection string

AcqAcc.ConnectionString = "Provider=MSDASQL;DSN=Acquist_Accounts;UID=internal;PWD=oracle;"
AcqAcc.open

' get data from logon_page and check against UserPassword table in the database
Set User = document.T1
MsgBox User

Set Pass = document.T2
MsgBox Pass

' check username & password
Set CheckUsername = AcqAcc.Execute( "SELECT USERNAME FROM UserPassword WHERE PASSLEVEL = 7" )
Set CheckPassword = AcqAcc.Execute( "SELECT PASSWORD FROM UserPassword WHERE PASSLEVEL = 7" )

If CheckUsername = User AND CheckPassword = Pass Then
MsgBox "Logged on"
Else MsgBox "Get Stuffed"

End if

' close and destroy the connection object
AcqAcc.Close
Set AcqAcc = Nothing



' MsgBox err.Description
End function
</script>

<body bgcolor="#FFFFFF">

<p>&nbsp;</p>

<p>&nbsp;</p>

<p align="center"><font size="7"><strong>Acquist Accounts</strong></font></p>

<hr size="12" noshade color="#808000">

<p>&nbsp;</p>

<p><font color="#000000" size="4">Welcome to Acquist Accounts
database. Please enter your Username and Password then click
submit to access your account details. Use the mouse to click
into the username field and then tab or click into the password
field, then click submit. You can reset the page by clicking
reset.</font></p>

<p>&nbsp;</p>

<form method="POST" onSubmit="Get_Username">

<p><font size="4">Enter Username: </font><input type="text" size="20" name="T1"></p>

<p><font size="4">Enter Password: </font><input type="password" size="20" name="T2"></p>

<p><input type="submit" name="B1" value="Submit" > <input type="reset" name="B2" value="Reset"></p>
</form>
</body>
</html>

Mark Sreeves
Aug 21st, 2000, 06:29 AM
Remove the On Error Resume next so you can see wha's happening


name your form frm1

and reference it like this

' get data from logon_page and check against UserPassword table in the database
User = document.frm1.T1.value
MsgBox User

Pass = document.frm1.T2.value
MsgBox Pass

Skeen
Aug 21st, 2000, 06:40 AM
Cheers Mark - that did the trick perfect
I'm a totally new to the VB script thing so my knowledge of the syntax is pretty poor.
Thanx again