I'm basically a ASP/web designer and try my best to get into the fun coding, so not sure as to the syntax of what I'm trying to do...
The structure I'm working on is
Database Connection
Select DB record occuring "Today" - have this working with BETWEEN statement
DO UNTIL RS.EOF
IF RS(title) < FromTime or >UntilTime Then
<display login HTML code>
ELSEIF RS(title) < UntilTime and > FromTime Then
<display downtime HTML message>
ELSEIF no record for today??
<display login HTML code>
END IF
Loop, close, etc...
This is displaying the maintenance message for the day of the downtime, but when there is none for the day, it displays nothing and I need to specify it to the times of the day specifically
If anyone can think of a better way to do this, I'm all ears, but The current code is below.
Expand|Select|Wrap|Line Numbers
- '*****************************************************************************
- ' block login function
- '*****************************************************************************
- sub Block_Login
- dim cn, rs, sql
- set cn=server.CreateObject("ADODB.Connection")
- set rs=server.CreateObject("ADODB.Recordset")
- Today = Date
- Tomorrow = DateAdd("d",1,Today)
- sql="select DowntimeDate, FromTime, UntilTime from Downtime where DowntimeDate BETWEEN '" & Today & "' AND '" & Tomorrow & "'"
- cn.Open Application("database")
- rs.Open sql, cn, 3, 3
- %>
- <%
- 'create variables
- Dim strDate, strTime, strBoth
- 'Set variable to todays date (and time)
- 'strDate = Date
- strTime = Time
- strBoth = Now
- %>
- <%
- DO UNTIL RS.EOF
- IF RS("DowntimeDate") = Today Then
- %>
- <p>System is currently undergoing maintenance
- from <%=rs("FromTime")%> EST until <%=rs("UntilTime")%> EST.
- <p>We apologize for any inconvenience.
- <% ELSEIF RS("DowntimeDate") <> Today Then%>
- <!-- BEGIN MEMBER LOGIN -->
- <iframe src="signon.html"
- name="signon"
- scrolling="no"></iframe>
- <br>
- <!-- END MEMBER LOGIN -->
- <%
- End IF
- RS.MoveNext
- Loop
- %>
- <%
- rs.Close
- cn.Close
- set rs=nothing
- set cn=nothing
- end sub