Prevent Click Fraud in Advertisement system with PHP and Javascript
<p>I would like to build an Advertising project with PHP, MySQL, and Javascript.  I am talking about something like...</p>

<ul>
<li>Google Adsense</li>
<li>BuySellAds.com</li>
<li>Any other advertising platform</li>
</ul>

<p>My question is mainly, what do I need to look out for to prevent people cheating the system and any other issues I may encounter?</p>

<p>My design concept.  An Advertisement is a record in the Database, when a page is loaded, using Javascript, it calls my server which in turn will use a PHP script to query the Database and get a random Advertisement.  (It may do kore like get an ad based on demographics or other criteria as well)  The PHP script will then return the Advertisement to the server/website that is calling it and show it on the page as an Image that will have a special tracking link.</p>

<p>I will need to...</p>

<ul>
<li>Count all impressions (when the Advertisement is shown on the page)</li>
<li>Count all clicks on the Advertisement link</li>
<li>Count all Unique clicks on the Advertisement link</li>
</ul>

<p>My question is purely on the query and displaying of the Advertisement and nothing to do with the administration side.  If there is ever money involved with my Advertisement buying/selling of adspace, then the stats need to be accurate and make sure people can't easily cheat the system.  Is tracking IP address really the only way to try to prevent click fraud?</p>

<p>I am hoping someone with some experience can clarify I am on the right track?  As well as give me any advice, tips, or anything else I should know about doing something like this?</p>
