use of session and cookies what is better
<p>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:</p>

<pre><code>&lt;input type="hidden" name="time_last_loaded" value="&lt;?php echo strtotime(date("Y-m-d H:i:s")); ?&gt;"&gt;

&lt;?
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 &lt;  $current_time)
    {
             echo "code works";
     }
}
?&gt;
</code></pre>

<p>But it is not working, could someone try to find a problem in what I have coded? Thank you!</p>

<p>i also tried this </p>

<pre><code>$time=time();
$timeend= $time + (1*60);
 for($i=1;$i&lt;100;$i++)
  {
  while($time &gt; $timeend)
  {
      echo "it works";
      $time=time();
      }
  }
</code></pre>

<p>y this simple piece of code not working? can any1 tell?</p>
