472,353 Members | 1,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Restrict page to open by date????

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
Dec 26 '06 #1
5 1526
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 <div>. If not, reveal
an hidden error <div>.

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/
----------------------------------------

Dec 26 '06 #2

"Trevor L." <Trevor_L.@Canberrawrote in message
news:%2****************@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 <div>. If not,
reveal an hidden error <div>.

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
Dec 26 '06 #3
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)
Dec 26 '06 #4

"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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.

--
Dec 26 '06 #5
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)
Dec 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to...
4
by: Neil Coleclough | last post by:
I am constructing a database to process product returns for my Company. I have a number of toggle buttons to identify the stage to which each...
28
by: gc | last post by:
Hi, What is the purpose of the restrict keyword? gc
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm...
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what...
4
by: Ralf | last post by:
Here is my scenerio and what I am doing. I am open to other ways of doing this is it makes sense. I have a cell withing a row within a datagrid. ...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then...
7
by: David McDivitt | last post by:
On my page I have a div appear, positioned next to the cursor, after dragging and dropping. The div contains radio buttons for what action is to be...
3
by: kmnotes04 | last post by:
Could anyone tell me how to restrict the date range for items that appear on a report? Old items from previous years appear on the report. I was...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.