Skip to main content
Participant
March 15, 2021
Question

prevent access to webpage by date and time

  • March 15, 2021
  • 3 replies
  • 214 views

Is it possible to prevent someone from viewing the contents of the webpage (partial or full) until a certain date and time? For example, if i have a webpage with a link, but only want that link on the webpage to be viewed at a certain start date and time, is this possible?

 

Thank you!

    This topic has been closed for replies.

    3 replies

    Legend
    March 15, 2021

    Do you know any php?

     

    You could do something like below, hard code the date at which point onwards you want the link to appear:

     

    <?php
    $date = date("Y-m-d");
    if($date >= "2021-03-15") { ?>
    <a href="showInfo.php?showInfo="true">Link</a>
    <?php } ?>

     

     

     

    On the showInfo.php page which the link is set to go to check to see if the 'showInfo' url parameter is set:

     

    <?php if(isset($_GET['showInfo'])) { ?>
    <h1>Welcome</h1>
    <?php } else { ?>
    <h1>No Access</h1>
    <?php } ?>

     

     

    B i r n o u
    Legend
    March 15, 2021

    does the code scare you, or can you write a few lines... this link should help you... in fact the HTML content will only be visible according to date ranges

    https://stackoverflow.com/questions/4319135/jquery-or-javascript-that-display-content-based-on-the-date-help

    BenPleysier
    Community Expert
    Community Expert
    March 15, 2021

    Don't publish the page until that certain date and time.

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Nancy OShea
    Community Expert
    Community Expert
    March 15, 2021

    If you're on Linux hosting, schedule a Cron Job to run a script at a given date and time (server's time).

    https://linuxize.com/post/scheduling-cron-jobs-with-crontab/

     

    Nancy O'Shea— Product User & Community Expert