39188-vm/verify_action.php
2026-03-14 01:48:22 +00:00

22 lines
481 B
PHP

<?php
require_once 'db/config.php';
$slug = $_GET['slug'] ?? '';
if (!$slug) die("Error.");
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM campaigns WHERE slug = ?");
$stmt->execute([$slug]);
$campaign = $stmt->fetch();
if ($campaign) {
// Log click
$stmt = $pdo->prepare("INSERT INTO stats (campaign_id, type) VALUES (?, 'click')");
$stmt->execute([$campaign['id']]);
header("Location: " . $campaign['offer_url']);
exit;
} else {
die("Error.");
}
?>