Skip to main content
Participant
Mar 15, 2021 6:59 AM UTC
Question

prevent access to webpage by date and time

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 is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    Legend
    Mar 15, 2021 3:01 PM UTC

    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 } ?>

     

     

    Translate
    B i r n o u
    Legend
    Mar 15, 2021 10:40 AM UTC

    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

    Translate
    BenPleysier
    Community Expert
    Community Expert
    Mar 15, 2021 9:39 AM UTC

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

    Translate
    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
    Mar 15, 2021 5:31 PM UTC

    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/

     

    Translate
    Nancy O'Shea— Product User & Community Expert