Results 1 to 10 of 10

Thread: Time-Dependant Page

  1. #1
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Time-Dependant Page

    Hi,
    I'm hoping someone can help me with this.

    I have a URL for which I'd like to limit access to by time. I have a URL that I don't want accessible on between 11:00 and 23:00 (server time)- so when someone clicks on the URL during this period, a message pops up saying somthing like "sorry we're closed now etc" ...

    Is this possible? if yes, how... !?

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

  3. #3
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <script language="text/javascript">
    Stamp = new Date();
    var hour;
    hour = Stamp.getHours();
    if (!(hour>=7&&hour<=21)) { document.location = 'locked.htm'; }
    </script>
    I understand this is the code to be used - but I DON'T UNDERSTAND HOW ... can someone explain!

  4. #4
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I've tried using the above script - without any luck... it seems I don't know how (not that it doesn't work)

    P.S. I've tried doing what this script does with the help of .htaccess files (like this):

    Code:
    Order deny,allow
    RewriteEngine  on
    RewriteCond   %{TIME_HOUR}%{TIME_MIN} >1100
    RewriteCond   %{TIME_HOUR}%{TIME_MIN} <2300
    RewriteRule   ^produse\.html$	produse_disponibile.html
    RewriteRule   ^produse\.html$	produse_indisponibile.html
    RewriteCond %{HTTP_USER_AGENT} Wget [OR] 
    RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR] 
    RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR] 
    RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR] 
    RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR] 
    RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR] 
    RewriteCond %{HTTP_USER_AGENT} ExtractorPro 
    RewriteRule ^.*$ deny.html [L]
    ErrorDocument 400 eroare.html
    DirectoryIndex index.html
    BUT, this doesn't work... don't know why!
    CAN ANYONE HELP!?

  5. #5
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Stamp = new Date();
    initiates the date javascript function
    var hour;
    hour = Stamp.getHours();
    gets the current hour

    if (!(hour>=7&&hour<=21)) { document.location = 'locked.htm'; }
    evaluates what hour it is.. if hour isn't between 0700 (7am) and 2100 (9pm) send send page to some url.

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    It is a script that will redirect if it is between that time.

    you place it inside the <head> tags on your page.

    You can also change the page-- locked.htm-- and the hours-- 7 and 21.

    That's Javascript, not PHP.

    However, a recent thread asked the same question; it has been answered several times. Search a bit and your answer will be there.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    boogyman, the problem is... I don't know WHERE (in what SECTION of the HTML page) to insert this script.

    P.S. THIS DOES IN THE PAGE I'M TRYING TO LIMIT ACCESS TO, RIGHT!?

  8. #8
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    put it in the<head> tags

    you can read the full thread that post was from @ http://www.dynamicdrive.com/forums/s...d.php?p=111938

  9. #9
    Join Date
    Apr 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    IT'S NOT WORKING
    DON'T KNOW WHY...

    P.S. HERE IS MY TEST LINK ... http://www.slickdeals.ro/pizza/

    THE LINK THAT SHOULD BE DISABLED NOW IS PRODUSE.

  10. #10
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    that page is not found giving me the 404 error page

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •