Sindbad~EG File Manager
<?php
require_once '../config/config.php';
// Check if tracking code is provided
if (!isset($_GET['code']) || empty($_GET['code'])) {
redirect('../index.php');
}
$tracking_code = sanitizeInput($_GET['code']);
// Get attendance record details
$db = new Database();
$conn = $db->getConnection();
$query = "SELECT ar.*, p.name as program_name, l.name as location_name,
ld.name as district_name_full, la.name as assembly_name_full
FROM attendance_records ar
JOIN programs p ON ar.program_id = p.id
LEFT JOIN locations l ON p.location_id = l.id
LEFT JOIN locations ld ON ar.district_id = ld.id
LEFT JOIN locations la ON ar.assembly_id = la.id
WHERE ar.tracking_code = ?";
$stmt = $conn->prepare($query);
$stmt->execute([$tracking_code]);
$record = $stmt->fetch();
if (!$record) {
redirect('../index.php');
}
// Get site settings
$query = "SELECT setting_key, setting_value FROM settings WHERE setting_key IN ('site_title', 'site_logo')";
$stmt = $conn->prepare($query);
$stmt->execute();
$settings = [];
while ($row = $stmt->fetch()) {
$settings[$row['setting_key']] = $row['setting_value'];
}
// Generate QR code URL (using a free QR code API)
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'];
$base_path = dirname(dirname($_SERVER['SCRIPT_NAME'])); // Go up one level from /attendance/
if ($base_path === '/' || $base_path === '\\') {
$base_path = '';
}
$status_url = $protocol . '://' . $host . $base_path . '/check_status.php?code=' . $tracking_code;
$qr_code_url = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" . urlencode($status_url);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thank You - <?php echo $settings['site_title'] ?? SITE_TITLE; ?></title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#3B82F6',
secondary: '#F59E0B',
accent: '#6B7280'
}
}
}
}
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
.gradient-bg {
background: linear-gradient(135deg, #3B82F6 0%, #F59E0B 50%, #6B7280 100%);
}
.success-animation {
animation: successPulse 2s ease-in-out infinite;
}
@keyframes successPulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.countdown {
font-size: 2rem;
font-weight: bold;
color: #3B82F6;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<!-- Header -->
<header class="gradient-bg text-white py-6">
<div class="container mx-auto px-4">
<div class="flex items-center justify-center">
<img src="../<?php echo $settings['site_logo'] ?? SITE_LOGO; ?>" alt="Logo" class="h-12 w-12 mr-4">
<h1 class="text-2xl font-bold"><?php echo $settings['site_title'] ?? SITE_TITLE; ?></h1>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-12">
<div class="max-w-2xl mx-auto">
<!-- Success Message -->
<div class="bg-white rounded-lg shadow-lg p-8 mb-8 text-center success-animation">
<div class="mb-6">
<div class="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i class="fas fa-check-circle text-green-600 text-4xl"></i>
</div>
<h2 class="text-3xl font-bold text-gray-900 mb-2">Thank You!</h2>
<p class="text-lg text-gray-600">Your attendance has been successfully recorded.</p>
</div>
<!-- Tracking Code -->
<div class="bg-blue-50 border-2 border-blue-200 rounded-lg p-6 mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-2">Your Tracking Code</h3>
<div class="text-3xl font-mono font-bold text-primary mb-2" id="trackingCode">
<?php echo $tracking_code; ?>
</div>
<p class="text-sm text-gray-600 mb-4">
Save this code to check your attendance details later
</p>
<button onclick="copyTrackingCode()" class="bg-primary text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition duration-300">
<i class="fas fa-copy mr-2"></i>Copy Code
</button>
</div>
<!-- QR Code -->
<div class="mb-6">
<h3 class="text-xl font-semibold text-gray-900 mb-4">QR Code</h3>
<div class="flex justify-center mb-4">
<img src="<?php echo $qr_code_url; ?>" alt="QR Code" class="border-2 border-gray-200 rounded-lg">
</div>
<p class="text-sm text-gray-600">
Scan this QR code to quickly access your attendance details
</p>
</div>
<!-- Attendance Details -->
<div class="bg-gray-50 rounded-lg p-6 mb-6 text-left">
<h3 class="text-lg font-semibold text-gray-900 mb-4">Attendance Details</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="text-sm font-medium text-gray-500">Full Name</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['full_name']); ?></p>
</div>
<div>
<label class="text-sm font-medium text-gray-500">Program</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['program_name']); ?></p>
</div>
<div>
<label class="text-sm font-medium text-gray-500">District</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['district_name_full'] ?: $record['district_name']); ?></p>
</div>
<div>
<label class="text-sm font-medium text-gray-500">Assembly</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['assembly_name_full'] ?: $record['assembly_name']); ?></p>
</div>
<?php if ($record['email']): ?>
<div>
<label class="text-sm font-medium text-gray-500">Email</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['email']); ?></p>
</div>
<?php endif; ?>
<?php if ($record['telephone']): ?>
<div>
<label class="text-sm font-medium text-gray-500">Phone</label>
<p class="text-gray-900"><?php echo htmlspecialchars($record['telephone']); ?></p>
</div>
<?php endif; ?>
<div class="md:col-span-2">
<label class="text-sm font-medium text-gray-500">Submission Date</label>
<p class="text-gray-900"><?php echo date('F j, Y g:i A', strtotime($record['submitted_at'])); ?></p>
</div>
</div>
</div>
</div>
<!-- Auto Redirect Notice -->
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-6 text-center">
<div class="flex items-center justify-center mb-4">
<i class="fas fa-clock text-yellow-600 text-2xl mr-3"></i>
<h3 class="text-lg font-semibold text-gray-900">Auto Redirect</h3>
</div>
<p class="text-gray-600 mb-4">
You will be redirected to the homepage in <span class="countdown" id="countdown">10</span> seconds
</p>
<div class="space-x-4">
<a href="../index.php" class="bg-primary text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition duration-300">
<i class="fas fa-home mr-2"></i>Go to Homepage
</a>
<a href="../check_status.php" class="bg-gray-600 text-white px-6 py-2 rounded-lg hover:bg-gray-700 transition duration-300">
<i class="fas fa-search mr-2"></i>Check Status
</a>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-8 mt-12">
<div class="container mx-auto px-4 text-center">
<p>© 2024 <?php echo $settings['site_title'] ?? SITE_TITLE; ?>. All rights reserved.</p>
</div>
</footer>
<script>
// Copy tracking code function
function copyTrackingCode() {
const trackingCode = document.getElementById('trackingCode').textContent.trim();
navigator.clipboard.writeText(trackingCode).then(function() {
// Show success message
const button = event.target.closest('button');
const originalText = button.innerHTML;
button.innerHTML = '<i class="fas fa-check mr-2"></i>Copied!';
button.classList.remove('bg-primary', 'hover:bg-blue-700');
button.classList.add('bg-green-600');
setTimeout(() => {
button.innerHTML = originalText;
button.classList.remove('bg-green-600');
button.classList.add('bg-primary', 'hover:bg-blue-700');
}, 2000);
}).catch(function(err) {
console.error('Could not copy text: ', err);
alert('Failed to copy tracking code. Please copy it manually: ' + trackingCode);
});
}
// Countdown timer
let countdown = 10;
const countdownElement = document.getElementById('countdown');
const timer = setInterval(() => {
countdown--;
countdownElement.textContent = countdown;
if (countdown <= 0) {
clearInterval(timer);
window.location.href = '../index.php';
}
}, 1000);
// Print functionality
function printPage() {
window.print();
}
</script>
</body>
</html>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists