> /home/u752449863/domains/relevantreflex.com/logs/timeout-cron.log 2>&1 */ // Prevent web access if (php_sapi_name() !== 'cli') { header('HTTP/1.0 403 Forbidden'); exit('CLI only'); } error_reporting(E_ALL); ini_set('display_errors', 0); ini_set('log_errors', 1); require_once __DIR__ . '/../clients/client-session.php'; $timestamp = date('Y-m-d H:i:s'); try { $pdo = getClientDBConnection(); // Mark all clicked URLs older than 2 hours as timeout $stmt = $pdo->prepare(" UPDATE survey_urls SET status = 'timeout' WHERE status = 'clicked' AND clicked_at < DATE_SUB(NOW(), INTERVAL 2 HOUR) "); $stmt->execute(); $count = $stmt->rowCount(); if ($count > 0) { echo "[$timestamp] Timed out $count URL(s)\n"; } else { echo "[$timestamp] No URLs to timeout\n"; } } catch (Exception $e) { echo "[$timestamp] ERROR: " . $e->getMessage() . "\n"; error_log("Timeout cron error: " . $e->getMessage()); exit(1); } ?>