php limit request per second
<p>Hello i'm having trouble with making like a simple waiting time between 2 php requests like...
i have this code (for example) :</p>

<pre><code>readfile($link);
</code></pre>

<p>the visitor request this php code to download a file ... but within 10 seconds he requests another one ... i want to make a limit for the time like if he requested once he has to waiting from the first download to the allowance to the second request (download) 30 seconds ... any idea of how could this be done ? in php ... thank you in advance :) </p>

<p>edit :
i tried with the help of the post below but did not work</p>

<pre><code>if (!isset($_SESSION['last_download'])) $_SESSION['last_download'] = 0; {
if (time() - $_SESSION['last_download'] &gt; 10){
    $_SESSION['last_download'] = time();
    echo $_SESSION['last_download'];
    }else {echo"".time() - $_SESSION['last_download']."";}}
</code></pre>

<p>but its not saving the session ... any help ?</p>
