Ciao a tutti, ho realizzato un sito con autenticazione degli utenti, funziona tutto perfettamente ma quando apro la pagina dell'amministratore, alla fine di questa, in basso mi da il seguente messaggio:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/adminlogin.asp, line 191
la pagina funziona perfettamente a prescindere da questo errore (permette l'autenticazione ecc.) e allora cos'è questo errore? sembra che manchino gli apici ma dove metterli? Ho cercato nel forum e ho visto che a tante persone è capitato lo stesso errore ma non riesco a risolvere il mio problema.
Vi posto a seguire il codice, vi prego aiutatemi sarà una sciocchezza ma sono ore che provo inutilmente.
Grazie 1000
<%@LANGUAGE="VBSCRIPT" %>
<%Response.Buffer = true %>
<html>
<head>
<title>Admin Login</title>
</head>
<body bgcolor="#FFFFFF">
<%if request.form("Submit")="Login" then
UserNameVar = Request.form("UserName")
PasswordVar = Request.form("Password")
' request variables for database here %>
<%' if they have not entered the necessary info
if (UserNameVar <> "" AND PasswordVar <> "") then
' check to see if they are an admin
set CheckAdmin = Server.CreateObject("ADODB.Recordset")
CheckAdmin.ActiveConnection = MM_LearningSite_STRING
CheckAdmin.Source = "SELECT * FROM Admin_Data WHERE UserID = '"& UserNameVar& "' AND Password= '" & PasswordVar & "'"
CheckAdmin.CursorType = 0
CheckAdmin.CursorLocation = 2
CheckAdmin.LockType = 3
CheckAdmin.Open
CheckAdmin_numRows = 0
' *** Recordset Stats: if we don't know the record count, manually count them
If (CheckAdmin_total = -1) Then
' count the total records by iterating through the recordset
CheckAdmin_total=0
While (Not CheckAdmin.EOF)
CheckAdmin_total = CheckAdmin_total + 1
CheckAdmin.MoveNext
Wend ' reset the cursor to the beginning
If (CheckAdmin.CursorType > 0) Then
CheckAdmin.MoveFirst
Else
CheckAdmin.Requery
End If
' set the number of rows displayed on this page
If (CheckAdmin_numRows < 0 Or CheckAdmin_numRows > CheckAdmin_total) Then
CheckAdmin_numRows = CheckAdmin_total
End If
' set the first and last displayed record
CheckAdmin_first = 1
CheckAdmin_last = CheckAdmin_first + CheckAdmin_numRows - 1
If (CheckAdmin_first > CheckAdmin_total) Then CheckAdmin_first = CheckAdmin_total
If (CheckAdmin_last > CheckAdmin_total) Then CheckAdmin_last = CheckAdmin_total
end if
if NOT CheckAdmin.EOF then
'-- Found an Admin record
Session("AdminID") = UserNameVar
Session("StudentID") = ""
response.redirect "adminmenu.asp"
end if%>
<% ' check to see if they are a student
set CheckStudent = Server.CreateObject("ADODB.Recordset")
CheckStudent.ActiveConnection = MM_LearningSite_STRING
CheckStudent.Source = "SELECT * FROM Student_Data WHERE UserID = '"& UserNameVar& "' AND Password= '" & PasswordVar & "'"
CheckStudent.CursorType = 0
CheckStudent.CursorLocation = 2
CheckStudent.LockType = 3
CheckStudent.Open
CheckStudent_numRows = 0
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
' set the record count
CheckStudent_total = CheckStudent.RecordCount
' set the number of rows displayed on this page
If (CheckStudent_numRows < 0) Then
CheckStudent_numRows = CheckStudent_total
Elseif (CheckStudent_numRows = 0) Then
CheckStudent_numRows = 1
End If
' set the first and last displayed record
CheckStudent_first = 1
CheckStudent_last = CheckStudent_first + CheckStudent_numRows - 1
' if we have the correct record count, check the other stats
If (CheckStudent_total <> -1) Then
If (CheckStudent_first > CheckStudent_total) Then CheckStudent_first = CheckStudent_total
If (CheckStudent_last > CheckStudent_total) Then CheckStudent_last = CheckStudent_total
If (CheckStudent_numRows > CheckStudent_total) Then CheckStudent_numRows = CheckStudent_total
End If
%>
<% ' *** Recordset Stats: if we don't know the record count, manually count them
If (CheckStudent_total = -1) Then
' count the total records by iterating through the recordset
CheckStudent_total=0
While (Not CheckStudent.EOF)
CheckStudent_total = CheckStudent_total + 1
CheckStudent.MoveNext
Wend
' reset the cursor to the beginning
If (CheckStudent.CursorType > 0) Then
CheckStudent.MoveFirst
Else
CheckStudent.Requery
End If
' set the number of rows displayed on this page
If (CheckStudent_numRows < 0 Or CheckStudent_numRows > CheckStudent_total) Then
CheckStudent_numRows = CheckStudent_total
End If
' set the first and last displayed record
CheckStudent_first = 1
CheckStudent_last = CheckStudent_first + CheckStudent_numRows - 1
If (CheckStudent_first > CheckStudent_total) Then CheckStudent_first = CheckStudent_total
If (CheckStudent_last > CheckStudent_total) Then CheckStudent_last = CheckStudent_total
End If %> <%
if NOT CheckStudent.EOF then
'-- Found a student record
Session("StudentID") = UserNameVar
Session("AdminID") = ""
response.redirect "reports/studentsPlus.asp?UserID=" & UserNameVar
end if%> <%' Not Student or Admin %>
<script language = "javascript">
alert("That user was not found.")
{history.back()}
</script>
<%'end if
else
' they don't have all info loaded
%>
<script language = "javascript">
alert("Both User ID and Password need a value.")
{history.back()}
</script>
<%end if
else%>
<form name="form1" method="post" action="adminlogin.asp">
<table width="270" border="0" align="center" bordercolor="#FFFFCC" bgcolor="#9999FF">
<tr bgcolor="#0000CC">
<td colspan="2" height="29">
<div align="center"><font size="4" face="Verdana, Arial, Helvetica, sans-serif" color="#FFCC99">Records
Administration</font></div>
</td>
</tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif">User ID:
</font></div>
</td>
<td>
<input type="text" name="UserName" value="<%= Request.Form("UserName") %>">
</td>
</tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif">Password:
</font></div>
</td>
<td>
<input type="password" name="Password" value="<%= Request.Form("Password") %>">
</td>
</tr>
<tr>
<td height="36">
<div align="right">
<input type="reset" name="Submit2" value="Reset">
</div>
</td>
<td height="36">
<div align="center">
<input type="submit" name="Submit" value="Login">
</div>
</td>
</tr>
</table>
</form>
<% end if%>
</body>
</html>
<%
CheckAdmin.Close()
Set CheckAdmin = Nothing
%>
<%
CheckStudent.Close()
Set CheckStudent = Nothing
%>