<?php
// track-ad-click.php
require_once 'includes/config.php';
require_once 'includes/db.php';
require_once 'includes/functions.php';
require_once 'includes/ads-functions.php';

// Rastrear clique apenas se o ID for fornecido
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $adId = intval($_GET['id']);
    trackAdClick($adId);
}

// Responder com um pixel transparente
header('Content-Type: image/gif');
echo base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');