php - How can I count valid clicks for my ads? -


i build own advertisement system. want user able specific amount, 5 cents, each click ad gets.

but facing problem. don't want users click bomb ads earn more. want count 1 click per user per ad.

this have come far ...

<?php  $ip = $_server['remote_addr'];  $query = mysql_query("select * user_ip ip = '{$ip}'");  if(!isset($_cookie['ad_click'])){     $_cookie['ad_click'] = 'ad number'; }elseif(mysql_num_rows($query) < 1){     mysql_query("insert user_ip (ip, time) values ('{$ip}', " . time() . ")"); }else{     // ad 1 more click user account }  ?> 

my main problem people can delete cookies , change ip address. won't work in real world.

there's no perfect way identify user, there enough imperfect ways that, if use them can make pretty guess.

  • ip address should first thing check. ip stay same during single session , weed out layman trying clickbomb.
  • user agent tell browser , os

on client side there's lot can do. check out evercookie:

  • standard http cookies
  • http strict transport security (hsts) pinning
  • local shared objects (flash cookies)
  • silverlight isolated storage
  • storing cookies in rgb values of auto-generated, force-cached pngs using html5 canvas tag read pixels (cookies) out
  • storing cookies in web history
  • storing cookies in http etags
  • storing cookies in web cache
  • window.name caching
  • internet explorer userdata storage
  • html5 session storage
  • html5 local storage
  • html5 global storage
  • html5 database storage via sqlite
  • html5 indexeddb
  • java jnlp persistenceservice
  • java cve-2013-0422 exploit (applet sandbox escaping)

pay attention unusual click frequency , strange patterns.


Comments