|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/fasthelp.cc/mail/ | |
|
Path: /home2/outerorb/fasthelp.cc/mail/pixel.php
Size: 2.1 KB
Permissions: 0644
<?php
/**
* 1x1 Transparent Tracking Pixel for Email Opens
*/
// Disable all caching
header('Content-Type: image/gif');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0');
header('Pragma: no-cache');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Output 1x1 transparent GIF immediately
// 43-byte minimal valid transparent GIF
$transparentGif = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
header('Content-Length: ' . strlen($transparentGif));
echo $transparentGif;
// Flush output buffer to client so email client doesn't wait
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} else {
if (ob_get_level() > 0) {
ob_end_flush();
}
flush();
}
// Background logging
try {
require_once __DIR__ . '/config/db.php';
require_once __DIR__ . '/includes/functions.php';
$token = trim($_GET['token'] ?? '');
$email = trim($_GET['email'] ?? '');
$invitationId = null;
$recipientName = null;
$pdo = getDb();
if (!empty($token)) {
$stmt = $pdo->prepare("SELECT id, recipient_email, recipient_name FROM `invitations` WHERE `token` = ? LIMIT 1");
$stmt->execute([$token]);
$inv = $stmt->fetch();
if ($inv) {
$invitationId = (int)$inv['id'];
$email = $inv['recipient_email'];
$recipientName = $inv['recipient_name'];
}
} elseif (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
$stmt = $pdo->prepare("SELECT id, recipient_name FROM `invitations` WHERE `recipient_email` = ? ORDER BY id DESC LIMIT 1");
$stmt->execute([$email]);
$inv = $stmt->fetch();
if ($inv) {
$invitationId = (int)$inv['id'];
$recipientName = $inv['recipient_name'];
}
}
if ($email || $invitationId) {
recordActivity('opened', $email, $recipientName, $invitationId);
}
} catch (Exception $e) {
// Fail silently in tracking pixel to avoid broken image display in email clients
error_log("Tracking pixel error: " . $e->getMessage());
}