title: How can I stop PHP sleep() affecting my whole PHP code?
body: <p>So, on my arcade, howlingdoggames.com.  I have a points system that gives you a point every time you visit a page with a game on. To reduce abuse of this, I would like to make some sort of delay, so its only awarded after 45 seconds.  Here's what I've tried:</p>
  <pre class="lang-php prettyprint-override"><code>if ($_SESSION['lastgame'] != $gameid) {
      sleep(45);
      $points = $points + $game_points;
      $_SESSION['lastgame'] = $gameid;
  }
  </code></pre>
  <p>But this just seems to halt my whole website for 45 seconds, because this is in <code>index.php</code>, along with a lot of other code for my site.</p>
  <p>Is there anyway I can isolate that bit of code, so it only makes the statement</p>
  <pre><code>$points = $points + $game_points;
  </code></pre>
  <p>wait for 45 seconds?</p>