Basically, if a user goes to proxy.php?id=73 on my site, it'll update the visits out counter for that link id by adding 1, so it adds 1 each time it is clicked.
However, that can obviously be cheated by someone clicking it 10 times in like 10 seconds and easily making the links out go to 10.
I want to like, let users click proxy.php?id=whatever as many times as they want, but only unique clicks are counted, so if i clicked a link 10 times, the links out for that id would go up 1, and not 10 like it does currently.
Is my code, I'm guessing I need some kind of if statement before the UPDATE query.
$5 to anyone who does it for me.
However, that can obviously be cheated by someone clicking it 10 times in like 10 seconds and easily making the links out go to 10.
I want to like, let users click proxy.php?id=whatever as many times as they want, but only unique clicks are counted, so if i clicked a link 10 times, the links out for that id would go up 1, and not 10 like it does currently.
PHP:
<?
// We need the database stuff
require 'config.php';
if ($_GET['id']) {
$id = mysql_real_escape_string(addslashes($_GET['id']));
// Check ID exists
$q = "SELECT * from links where link_id = '$id'";
$res = mysql_query($q) or die("Error in query " . mysql_error());
$nr = mysql_num_rows($res);
if ($nr > 0) {
$data = mysql_fetch_assoc($res);
mysql_query("UPDATE links set link_visitors = (link_visitors + 1) where link_id = '$id'");
?>
Is my code, I'm guessing I need some kind of if statement before the UPDATE query.
$5 to anyone who does it for me.










