Restrict page to open by date????

Restrict page to open by date????

am 26.12.2006 04:33:01 von Marce Poulin

I'm trying to find out how I can make a page to be restricted to open
between Saturdays 12:05 pm until Sundays10: pm... and that.. EVERY WEEK...
is there any way at all to do this or is it just simply impossible.???
thanks

Re: Restrict page to open by date????

am 26.12.2006 05:17:23 von Trevor_L.

Marce Poulin wrote:
> I'm trying to find out how I can make a page to be restricted to open
> between Saturdays 12:05 pm until Sundays10: pm... and that.. EVERY
> WEEK... is there any way at all to do this or is it just simply
> impossible.??? thanks

I'd have to think know about doing it using ASP.

But with client side Javascript, one could extract the current date and time
and then check it against that time window.

If it is within that time window, then reveal a hidden

. If not, reveal
an hidden error
.

A side issue is what time?
The time on the visitor's server?
This could differ widely.

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------

Re: Restrict page to open by date????

am 26.12.2006 10:07:43 von Mike Brind

"Trevor L." wrote in message
news:%23I5yCTKKHHA.1044@TK2MSFTNGP02.phx.gbl...
> Marce Poulin wrote:
>> I'm trying to find out how I can make a page to be restricted to open
>> between Saturdays 12:05 pm until Sundays10: pm... and that.. EVERY
>> WEEK... is there any way at all to do this or is it just simply
>> impossible.??? thanks
>
> I'd have to think know about doing it using ASP.

The following will set a boolean value to True if the time on the server
falls between the limits set in the OP. If False, it redirects the browser
to another page.

<%
Dim opened
opened = False
If WeekDay(Now()) >= 7 And Hour(Now()) >= 12 And Minute(Now()) >= 5 Then
opened = True
If WeekDay(Now()) <= 1 And Hour(Now()) <= 22 And Minute(Now()) <> 0 Then
opened = True
If opened = False Then Response.Redirect "otherpage"
%>

>
> But with client side Javascript, one could extract the current date and
> time and then check it against that time window.

Not a good idea. If the purpose is to prevent access to the content of a
page then client-side javascript can easily be disabled, rendering it
useless.

>
> If it is within that time window, then reveal a hidden

. If not,
> reveal an hidden error
.
>
> A side issue is what time?
> The time on the visitor's server?

Another good reason not to use client-side code. ASP acts on the hosting
server, where the time zone is predictable. Additionally, placing the
restricted content in a div with it's "visible" set to none does not prevent
the content being readable in the source code of the page. That is no more
secure than using hidden form fields for sensitive information, for example.

--
Mike Brind

Re: Restrict page to open by date????

am 26.12.2006 17:47:16 von exjxw.hannivoort

Mike Brind wrote on 26 dec 2006 in
microsoft.public.inetserver.asp.general:

>> Marce Poulin wrote:
>>> I'm trying to find out how I can make a page to be restricted to
>>> open between Saturdays 12:05 pm until Sundays10: pm... and that..
>>> EVERY WEEK... is there any way at all to do this or is it just
>>> simply impossible.??? thanks

> <%
> Dim opened
> opened = False
> If WeekDay(Now()) >= 7 And Hour(Now()) >= 12 And Minute(Now()) >= 5

What about:
13:04
14:04
..... ?

> Then opened = True
> If WeekDay(Now()) <= 1 And Hour(Now()) <= 22 And Minute(Now()) <> 0

what about 17:00 exactly ?

WeekDay(Now()) >= 7
WeekDay(Now()) <= 1

why the < and the > ?

> Then opened = True
> If opened = False Then Response.Redirect "otherpage"
> %>
>

Try:

<%
If NOT _
( WeekDay(Now())=7 _
AND _
( ( Hour(Now())=12 AND Minute(Now())>4 ) OR Hour(Now())>12 ) )_
AND NOT _
( WeekDay(Now())=1 AND Hour(Now())<22 ) _
Then
Response.Redirect "otherpage"
End If
%>

or [I like this one better]:

<%

mn = Hour(Now())*60 + Minute(Now())
wd = WeekDay(Now())

If NOT ( wd=7 AND mn>12*60+4 ) _
AND NOT ( wd=1 AND mn<22*60 ) Then
Response.Redirect "otherpage"
End If

%>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Restrict page to open by date????

am 26.12.2006 19:10:32 von Mike Brind

"Evertjan." wrote in message
news:Xns98A5B4F28EA2Beejj99@194.109.133.242...
> Mike Brind wrote on 26 dec 2006 in
> microsoft.public.inetserver.asp.general:
>
>>> Marce Poulin wrote:
>>>> I'm trying to find out how I can make a page to be restricted to
>>>> open between Saturdays 12:05 pm until Sundays10: pm... and that..
>>>> EVERY WEEK... is there any way at all to do this or is it just
>>>> simply impossible.??? thanks
>
>> <%
>> Dim opened
>> opened = False
>> If WeekDay(Now()) >= 7 And Hour(Now()) >= 12 And Minute(Now()) >= 5
>
> What about:
> 13:04
> 14:04
> .... ?
>
>> Then opened = True
>> If WeekDay(Now()) <= 1 And Hour(Now()) <= 22 And Minute(Now()) <> 0
>
> what about 17:00 exactly ?
>
> WeekDay(Now()) >= 7
> WeekDay(Now()) <= 1
>
> why the < and the > ?
>
>> Then opened = True
>> If opened = False Then Response.Redirect "otherpage"
>> %>
>>
>
> Try:
>
> <%
> If NOT _
> ( WeekDay(Now())=7 _
> AND _
> ( ( Hour(Now())=12 AND Minute(Now())>4 ) OR Hour(Now())>12 ) )_
> AND NOT _
> ( WeekDay(Now())=1 AND Hour(Now())<22 ) _
> Then
> Response.Redirect "otherpage"
> End If
> %>
>
> or [I like this one better]:
>
> <%
>
> mn = Hour(Now())*60 + Minute(Now())
> wd = WeekDay(Now())
>
> If NOT ( wd=7 AND mn>12*60+4 ) _
> AND NOT ( wd=1 AND mn<22*60 ) Then
> Response.Redirect "otherpage"
> End If
>
> %>
>

I think the most suitable expression I can come up with is Doh!

I prefer your second one too.

--

Re: Restrict page to open by date????

am 26.12.2006 19:36:54 von exjxw.hannivoort

Mike Brind wrote on 26 dec 2006 in microsoft.public.inetserver.asp.general:
> I prefer your second one too.

At my third xmass meal my wandering mind came up with this:

<%

n = DateAdd("h", 6, Now)
'' Time zone correction in my case, server to main user group.
'' Calling now() only once prevents the minute possiblility of a
'' in row date switch.

minutes = (WeekDay(n)-1)*60*24 + Hour(n)*60 + Minute(n)
'' total of minutes since last Sunday 00:00

If ( minutes > 0*60*24+22*60-1 ) OR ( minutes < 6*60*24+12*60+5 ) Then
Response.Redirect "otherpage"
End If

%>

So we skip all those error prone NOTs.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)