-
date validation
Hi All,
I have given this work to give promotion on internet once a day, its not showing me the the result I want, I don't know where I am wrong. I am very new in this area, Please Please somebody help me......
Many thanks in advance.
Here is the code:
<%@ LANGUAGE="VBScript" ENABLESESSIONSTATE="False" LCID="4105"%>
<% Option Explicit%>
<%
Dim fsoObject
Dim CounterFile
Dim CounterValue
Dim PopUp
Const COUNTER_PATH = "D:Usershtmlwinter_testdatacounter.txt"
PopUp = False
Sub Init()
End Sub
Sub Main()
Call Init()
On Error Resume Next
'Read
Set fsoObject = Server.CreateObject("Scripting.FileSystemObjec t"
Set CounterFile = fsoObject.OpenTextFile(COUNTER_PATH,1,True)
CounterValue = CounterFile.ReadAll
'Close
CounterFile.Close
Set CounterFile = Nothing
Set fsoObject = Nothing
If Date() = CounterValue Then
If Hour(time) > 9 And Hour(time) < 23 Then
PopUp = True
'Write
Set fsoObject = Server.CreateObject("Scripting.FileSystemObjec t"
Set CounterFile = fsoObject.CreateTextFile(COUNTER_PATH,True)
CounterFile.WriteLine (Date() + 1)
'Close
CounterFile.Close
Set CounterFile = Nothing
Set fsoObject = Nothing
End If
End If
If Err.Number <> 0 Then
CounterValue = "?"
Err.Clear
End If
Call Terminate()
End Sub
Sub Terminate()
End Sub
Call Main()
%>
<% IF PopUP Then %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html401/loose.dtd">
<HTML>
<HEAD>
<TITLE>You Won!!!</TITLE>
</HEAD>
<BODY>
<B><%Response.Write CounterValue%> = Counter</B><BR>
<%Response.Write Date()%><BR>
<%Response.Write Time()%>
<BR><BR>
Woohooo !<BR><BR>
<FORM ACTION="default3.asp" METHOD="POST">
<SELECT NAME="City">
<OPTION VALUE="Here">Here (Ottawa Region)</OPTION>
<OPTION VALUE="Outside">Outside</OPTION>
</SELECT>
<INPUT TYPE="submit" VALUE="GO">
</FORM>
</BODY>
</HTML>
<% Else %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/REC-html401/loose.dtd">
<HTML>
<HEAD>
<TITLE>!!!</TITLE>
</HEAD>
<BODY>
Counter = <% Response.Write CounterValue %><BR>
Time = <% Response.Write Hour(time) %><BR>
Date = <% Response.Write Date() %><BR>
</BODY>
</HTML>
<% End IF %>
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
|
|