I want to get the current time when a page loads for first time and then to compare that time to the current time only if the difference is more than 30 minutes from the first time the page was loaded, a new window should be opened. I wanted to ask that to do all this what should i use session or cookies? I have tired using the following:
<input type="hidden" name="time_last_loaded" value="<?php echo strtotime(date("Y-m-d H:i:s")); ?>">
<?
if(isset($_POST['time_last_loaded']))
{
$current_time = strtotime(date("Y-m-d H:i:s"));
$time_last_loaded_plus_30_mins = strtotime('+30 minutes', $_POST['time_last_loaded']));
if($time_last_loaded_plus_30_mins < $current_time)
{
echo "code works";
}
}
?>
But it is not working, could someone try to find a problem in what I have coded? Thank you!
i also tried this
$time=time();
$timeend= $time + (1*60);
for($i=1;$i<100;$i++)
{
while($time > $timeend)
{
echo "it works";
$time=time();
}
}
y this simple piece of code not working? can any1 tell?