| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/public_html/bway/ |
Upload File : |
<?php
/**
* Giving Tuesday Click Tracker
* Replaces: gt.cfm
*
* Tracks clicks on theater websites from the givingtuesday table, increments counter, and redirects.
*/
require_once __DIR__ . '/db/mysql_bootstrap.php';
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Headers: Content-Type');
$id = $_GET['id'] ?? '';
if (!is_numeric($id)) {
echo 'Invalid Request: Missing or invalid ID parameter.';
exit;
}
$id = (int)$id;
$db = new PDO(
'mysql:host=amazonaurora.cluster-cemzxojvmybt.us-east-1.rds.amazonaws.com;dbname=amazonrds;charset=utf8mb4',
'admin',
'xxatN6Lb8Kbwb9MiU1At',
mysqlPdoOptions([PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false])
);
$stmt = $db->prepare("SELECT theater_website, clicks FROM alandev.givingtuesday WHERE id = ?");
$stmt->execute([$id]);
$row = $stmt->fetch();
if (!$row) {
echo "Invalid Request: Record not found for ID $id.";
exit;
}
$theaterWebsite = $row['theater_website'];
$clicks = $row['clicks'];
// Add https:// if missing
if (stripos($theaterWebsite, 'http://') !== 0 && stripos($theaterWebsite, 'https://') !== 0) {
$theaterWebsite = 'https://' . $theaterWebsite;
}
// Handle clicks
if ($clicks === null || $clicks === '') {
$stmt = $db->prepare("UPDATE alandev.givingtuesday SET clicks = 1 WHERE id = ?");
$stmt->execute([$id]);
} elseif (is_numeric($clicks)) {
$stmt = $db->prepare("UPDATE alandev.givingtuesday SET clicks = clicks + 1 WHERE id = ?");
$stmt->execute([$id]);
} else {
echo 'Error: Invalid value for clicks in database.';
exit;
}
header('Location: ' . $theaterWebsite);
exit;