$datecheck"; $query = sprintf("SELECT * FROM outfitter_clicklog WHERE outfitterid = '%d' AND event = '%s' AND ip = '%s' AND UNIX_TIMESTAMP(date) > $datecheck", cleanDB($id), cleanDB($event), cleanDB($ip)); $result = mysql_query($query); if (mysql_num_rows($result) == 0){ //$query = "INSERT INTO outfitter_clicklog SET outfitterid = $id, event = '$event', ip = '$ip', price = '$eventprice'"; $query = sprintf("INSERT INTO outfitter_clicklog SET outfitterid = '%d', event = '%s', ip = '%s', price = '%f'", cleanDB($id), cleanDB($event), cleanDB($ip), cleanDB($eventprice)); $result = mysql_query($query); // free clicks for 30 days $today = mktime(); $date = $today - (60 * 60 * 24 * 30); // minus 30 days $d = explode($row->datejoined,"-"); $datejoined = mktime(0,0,0,$d[1], $d[2], $d[0]); if ($datejoined < $date && $today > mktime(0,0,0,6,16,2005)){ //$query = "UPDATE outfitters SET balance = balance - $eventprice, dailybalance = dailybalance - $eventprice WHERE outfitterid = '$id'"; $query = sprintf("UPDATE outfitters SET balance = balance - %f, dailybalance = dailybalance - %f WHERE outfitterid = '%d'", cleanDB($eventprice), cleanDB($eventprice), cleanDB($id)); $result = mysql_query($query); } } } header("location: http://{$row->website}"); exit(); ?>