IF ELSE statements
I'm not very comfortable with ASP, and I'm not sure if IF/ELSE statements can be set up like they are in my code. I'm hoping someone can explain why I'm getting the Error Type: Microsoft VBScript compilation (0x800A03F6) Expected 'End' /signupe.asp, line 18. Here's my code:
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<HTML>
<SCRIPT RUNAT=Server LANGUAGE=VBScript>
Sub Session_OnStart
'Make sure that new users start on the correct
'page of the ASP application.
startPage = "/Login.asp"
currentPage = Request.ServerVariables("SCRIPT_NAME")
'Do a case-insensitive compare, and if they
'don't match, send the user to the start page.
If strcomp(currentPage,startPage,1) then
Response.Redirect(startPage)
End If
End Sub
</SCRIPT>
<%
Dim SQL
Dim DetailNum
Dim pin
Dim Closed
Dim requested
%>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="60;URL=logged_out.htm">
<TITLE>Detail Sign Up</TITLE>
</HEAD>
<BODY background="imagefile/Police.gif" Link="blue" Alink="purple" Vlink="red">
<%
Session("count") = Session("count") + 1
If Session("count") < 5 then
Session("count") = 0
Session_Onstart
End if%>
<p><img border="0" src="imagefile/APD_Patch.gif" width="116" height="140">
<b>
<% DetailNum=Request.Form("DetailNum") %>
<% pin=Request.Form("PIN") %>
<% Closed=Request.Form("Closed") %>
<% If Closed then
Response.Write("Sorry, the closing time has passed for this detail.<br><br>Please press the <i>Back</i> button in your browser to continue.<br>Remember to close your browser window when finished!!")
Else
SQL="SELECT PIN, DetailNum FROM RequestedDetails WHERE PIN=" & pin & " AND DetailNum='" & DetailNum & "'"
set conn = server.createobject ("ADODB.Connection")
conn.open "ot"
set requested = conn.execute(SQL)
If requested.bof and requested.eof then
Response.Write ("You have already signed up for this detail!")
requested.close
Else
SQL="INSERT INTO RequestedDetails (DetailNum, PIN) VALUES (" & DetailNum & ", " & pin & ")"
set conn = server.createobject ("ADODB.Connection")
conn.open "OT"
conn.execute(SQL)
Response.Write ("You have been successfully placed on the list for this detail.<br><br>Please press the <i>Back</i> button in your browser to continue.<br>Click the <i>Log Out</i> button if you are finished.")
%>
<form action="Logout.asp" target="_top" method="POST" name="LogOut" Autocomplete="OFF">
<input type="Submit" value=" Log Out " align="Left">
</form>
<%
End If
%>
</b>
</BODY>
</HTML>
|