Hi,
in my drupal instance is a naughty js, which is causing the double clicking of an ad. This causes a double insert-query of the click. I've written a fix for that:
change the code in the file affiliates.module, at the function affiliates_click();, where the INSERT INTO {affiliates} [...] mysql query appears.
/**
* prevent from double clicking
* because in some drupal-instaces is a naughty javascript
* which runs the insert-query twice.
*/
$result = db_query("SELECT click_time
FROM {affiliates}
WHERE click_time = %d", time());
$data = db_fetch_object($result);
if(empty($data)){
db_query("INSERT INTO {affiliates} (
user_id, cookie_id, ip, referer, ad_id, click_time)
VALUES
(%d, '%s', '%s', '%s', %d, %d)",
$uid, $cookie_value, ip_address(), filter_xss($_SERVER['HTTP_REFERER']), $ad_id, time());
}
hope somebody will commit this soon.
Comments
Comment #1
jepster_this code needs to be in
near line 1145.
for better understanding, here is my full affiliates_click()-function:
Comment #2
avpadernoI am closing this issue, as Drupal 6 is no longer supported.