Verify that clicks are coming from own website
<p>I have a file go.php on my website that tracks the clicks on certain links and I want to count only the clicks that are made on my website and not on other sites that copy that link (site.com/go.php?id=). I have tried with this code</p>

<pre><code>if($_SERVER[HTTP_REFERER] &amp;&amp; !preg_match("/site\.com/", $_SERVER[HTTP_REFERER])) {
    header("Location: http:// www .site.com");
    die();
}
</code></pre>

<p>but is not working properly, clicks from other sites are counted. Is there any way to count only the clicks made on my website?</p>

<hr>

<p><strong>EDIT:</strong> I formatted the code, but I left the spaces near <code>http://</code> and <code>www</code>. -gore</p>
