Php code for opening a page hourly by clicking a button

Viewed 28

Hi I don't know how to post a question I will tr my best to explain you

when i click a button it will redirect us to other page

but from 10:00 am to 11:100 am, 12:00 pm to 1:00pm, 02:00pm to 03:00pm when we click the button it has to show a message came back at after one hour

and in between 11:00 pm to 12:00 pm, 01:00 Pm to 02:00 pm, 03:00 pm to 04:00 pm it has to work and redirect us to the page

now, after redirecting into the page example he opened the page at 11:55 pm and was filling his form and the time is 12:01 pm then the application has to reset itself and has to come back to homepage and display a message that come back in one hour

please help me thank you

i tried this and what is the problem in the coding
<?php

$utc = "";
$new = new DateTime($utc);
$tz = new DateTimeZone('Asia/Kolkata');
$new->setTimezone($tz);
echo $new->format('h:i:a');

$hide1 = "";
$hide2 = "";

$open = date("12:37:pm");
$close = date("12:40:pm");

if ($new > $open && $new < $close) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open1 = date("04:00:pm");
$close1 = date("04:10:pm");

if ($new > $open1 && $new < $close1) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open2 = date("08:00:pm");
$close2 = date("08:10:pm");

if ($new > $open2 && $new < $close2) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open3 = date("08:50:pm");
$close3 = date("09:00:pm");

if ($new > $open3 && $new < $close3) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open4 = date("9:50:pm");
$close4 = date("10:00:pm");

if ($new > $open4 && $new < $close4) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open5 = date("10:00:pm");
$close5 = date("10:10:pm");

if ($new > $open5 && $new < $close5) {
    $hide1 = "<!--";
    $hide2 = "-->";
}

$open6 = date("10:50:pm");
$close6 = date("11:00:pm");

if ($new > $open6 && $new < $close6) {
    $hide1 = "<!--";
    $hide2 = "-->";
}


?>


<!DOCTYPE html>
<html lang="en">

<head>
</head>

<body>
    <?php echo $hide1; ?>
    <div class="grid-item">
        <a href="../games/create/doublepana.php">
            <img src="../../assets/images/1.jpg" alt="Double Panna" height="225px" width="180px">
            </img>
        </a>
        <h6>DOUBLE PANA</h6>
    </div>
    <?php echo $hide2; ?>
</body>

</html>

it is not running as I wanted

0 Answers
Related