92 lines
2.6 KiB
PHP
92 lines
2.6 KiB
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_GET['code'])) {
|
|
die("Certificate code is missing.");
|
|
}
|
|
|
|
$certificate_code = $_GET['code'];
|
|
$pdo = db();
|
|
|
|
$stmt = $pdo->prepare("
|
|
SELECT
|
|
c.certificate_code,
|
|
u.name as user_name,
|
|
comp.title as competition_title,
|
|
s.uploaded_at
|
|
FROM certificates c
|
|
JOIN submissions s ON c.submission_id = s.id
|
|
JOIN users u ON s.user_id = u.id
|
|
JOIN competitions comp ON s.competition_id = comp.id
|
|
WHERE c.certificate_code = ?
|
|
");
|
|
$stmt->execute([$certificate_code]);
|
|
$certificate = $stmt->fetch();
|
|
|
|
if (!$certificate) {
|
|
die("Invalid certificate code.");
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Certificate of Achievement</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
background-color: #f0f2f5;
|
|
}
|
|
.certificate-container {
|
|
max-width: 800px;
|
|
margin: 50px auto;
|
|
border: 10px solid #ddd;
|
|
padding: 50px;
|
|
background: #fff;
|
|
text-align: center;
|
|
font-family: 'Times New Roman', Times, serif;
|
|
}
|
|
.certificate-title {
|
|
font-size: 50px;
|
|
font-weight: bold;
|
|
color: #333;
|
|
}
|
|
.certificate-subtitle {
|
|
font-size: 25px;
|
|
color: #555;
|
|
}
|
|
.user-name {
|
|
font-size: 40px;
|
|
font-style: italic;
|
|
color: #007bff;
|
|
margin: 40px 0;
|
|
}
|
|
.competition-title {
|
|
font-size: 30px;
|
|
color: #333;
|
|
}
|
|
.date {
|
|
font-size: 20px;
|
|
color: #777;
|
|
margin-top: 40px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="certificate-container">
|
|
<div class="certificate-title">Certificate of Achievement</div>
|
|
<div class="certificate-subtitle">This is to certify that</div>
|
|
<div class="user-name"><?php echo htmlspecialchars($certificate['user_name']); ?></div>
|
|
<div class="certificate-subtitle">has successfully participated in the</div>
|
|
<div class="competition-title"><?php echo htmlspecialchars($certificate['competition_title']); ?></div>
|
|
<div class="date">Date: <?php echo date("F j, Y", strtotime($certificate['uploaded_at'])); ?></div>
|
|
<div class="mt-5">
|
|
<small>Certificate Code: <?php echo htmlspecialchars($certificate['certificate_code']); ?></small>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|