|
-
Aug 21st, 2000, 03:25 AM
#1
Thread Starter
Addicted Member
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> </p>
<p> </p>
<p align="center"><font size="7"><strong>Acquist Accounts</strong></font></p>
<hr size="12" noshade color="#808000">
<p> </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> </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>
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Aug 21st, 2000, 06:29 AM
#2
Frenzied Member
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
-
Aug 21st, 2000, 06:40 AM
#3
Thread Starter
Addicted Member
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
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|