Login | |
|
 |
RE: vbscript for web login page - 5/16/2008 4:15:35 AM
|
|
 |
|
| |
dartcoach
Posts: 4
Score: 0
Joined: 5/16/2008
Status: offline
|
Hi All, Got it working! 1 problem though: Each time I open the login page, I get ADO warning messages about the provider being unsafe. Any idea on how to get rid of it? Thanks in advance!
_____________________________
dartcoach
|
|
| |
|
|
|
 |
RE: vbscript for web login page - 5/16/2008 10:11:07 AM
|
|
 |
|
| |
TNO
Posts: 1284
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I'm honestly confused on how you got it to work without ASP. did you do this? <script language="vbscript" runat="server"> What is your current code?
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: vbscript for web login page - 5/17/2008 3:28:20 AM
|
|
 |
|
| |
dartcoach
Posts: 4
Score: 0
Joined: 5/16/2008
Status: offline
|
Here's the current code for the page: <html> <head> <script language="vbscript"> Option Explicit ' define constants of ADO Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 ' define the Access DB path Const DBPath = "C:\users.accdb" Main() Sub Main ' create adodb connection & recordset objects Dim objConn Set objConn = CreateObject("ADODB.Connection") Dim objRecordSet Set objRecordSet = CreateObject("ADODB.Recordset") objRecordset.CursorLocation = adUseClient dim objValid ' define query Dim strSQLQuery ' msgbox "UserName: " & document.loginform.username.value strSQLQuery = "SELECT * FROM login WHERE username='" & document.loginform.username.value & "'" & " AND password='" & document.loginform.password.value & "'" msgbox strSQLQuery If QueryTable(objConn, objRecordSet, strSQLQuery) Then msgbox "Hello!" window.location.href = "_web/index.htm" Else msgbox "No records found matching your query!" response.redirect ("underconstruction.html") End If ' close connections objRecordSet.Close objConn.Close End Sub Sub varRedirect If QueryTable(objConn, objRecordSet, strSQLQuery) Then msgbox "Hello!" window.location.href = "/_web/index.htm" Else msgbox "trying to redirect" response.redirect ("underconstruction.htm") End If End Sub Function QueryTable(objConn, objRecordSet, strQuery) objConn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Persist Security Info=False; Data Source=" & DBPath objRecordSet.Open strQuery, objConn, adOpenStatic, adLockOptimistic ' if the query returns a value then move to the first record & return true If Not objRecordSet.EOF Then objRecordSet.MoveFirst QueryTable = True Else ' return false if query do not return anything QueryTable = False End If End Function </script> </Head> <body bgcolor="#ffffff" background="parchment.jpg"> <form name="loginform" method="post" onsubmit="Main()" action="varRedirect"> <span class="bodytext">User Name:  <input name="UserName" type=text id="username"><br /> <span class="bodytext">Password:  <input name="Password" type=password id="password"><br /> <input name="btnSend" type=submit value="Login"> </form> </body> </html> Page works as far as validating the username and password. Redirect doesn't and the pages are valid. I also still get the ADO warnings which I would like to suppress. Thanks!
_____________________________
dartcoach
|
|
| |
|
|
|
 |
RE: vbscript for web login page - 5/17/2008 8:14:05 AM
|
|
 |
|
| |
TNO
Posts: 1284
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
You're getting warnings because the webpage is accessing a database on your computer, not the server, redirect is also failing then I assume for the same reason since your page is set up for the client. Hence my question about runat="server".
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: vbscript for web login page - 5/19/2008 3:11:08 AM
|
|
 |
|
| |
dartcoach
Posts: 4
Score: 0
Joined: 5/16/2008
Status: offline
|
TNO, Thanks! I've added the runat="server" to the page. I have to get my webserver admin to change some settings to allow the page to run though. As soon as they do that, I'll try the test again and let you know. Thanks again!
_____________________________
dartcoach
|
|
| |
|
|
|
|
|