uawdijnntqw1x1x1
IP : 216.73.216.93
Hostname : panel.codeskitter.com
Kernel : Linux panel.codeskitter.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
Disable Function : apache_child_terminate, apache_note, apache_setenv, define_syslog_variables, dl, link, opcache_get_status, openlog, pcntl_exec, pcntl_fork, pcntl_setpriority, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid
OS : Linux
PATH:
/
home
/
users
/
unlimited
/
www
/
nigeria.codeskitter.site
/
student
/
certificates.php
/
/
<?php include '../includes/config.php'; if(!isset($_SESSION['user_id']) || $_SESSION['user_role'] != 'student') { header("Location: ../login.php"); exit(); } $user_id = $_SESSION['user_id']; // Get completed courses with certificates $certificates_sql = "SELECT c.*, cert.issued_at, cert.certificate_url FROM certificates cert JOIN courses c ON cert.course_id = c.id WHERE cert.user_id = ? ORDER BY cert.issued_at DESC"; $stmt = $conn->prepare($certificates_sql); $stmt->bind_param("i", $user_id); $stmt->execute(); $certificates = $stmt->get_result(); // Get courses eligible for certificates (completed but no certificate yet) $eligible_courses_sql = "SELECT c.*, e.completed_at FROM enrollments e JOIN courses c ON e.course_id = c.id LEFT JOIN certificates cert ON e.course_id = cert.course_id AND e.user_id = cert.user_id WHERE e.user_id = ? AND e.progress = 100 AND cert.id IS NULL"; $stmt_eligible = $conn->prepare($eligible_courses_sql); $stmt_eligible->bind_param("i", $user_id); $stmt_eligible->execute(); $eligible_courses = $stmt_eligible->get_result(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Certificates - eLearning</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css"> <link rel="stylesheet" href="../assets/css/style.css"> </head> <body> <?php include 'navigation.php'; ?> <div class="container-fluid py-4"> <div class="row"> <div class="col-12"> <h1 class="mb-4">My Certificates</h1> <!-- Available Certificates --> <div class="card mb-5"> <div class="card-header"> <h5 class="mb-0">Earned Certificates</h5> </div> <div class="card-body"> <?php if($certificates->num_rows > 0): ?> <div class="row"> <?php while($cert = $certificates->fetch_assoc()): ?> <div class="col-md-6 col-lg-4 mb-4"> <div class="card certificate-card h-100"> <div class="card-body text-center"> <div class="certificate-badge mb-3"> <i class="bi bi-award-fill fs-1"></i> </div> <h5><?php echo $cert['title']; ?></h5> <p class="text-muted">Completed on <?php echo date('F j, Y', strtotime($cert['issued_at'])); ?></p> <?php if($cert['certificate_url']): ?> <a href="<?php echo $cert['certificate_url']; ?>" class="btn btn-primary" target="_blank"> <i class="bi bi-download"></i> Download Certificate </a> <?php else: ?> <button class="btn btn-outline-primary generate-certificate" data-course-id="<?php echo $cert['id']; ?>"> Generate Certificate </button> <?php endif; ?> </div> </div> </div> <?php endwhile; ?> </div> <?php else: ?> <div class="text-center py-5"> <i class="bi bi-award fs-1 text-muted mb-3"></i> <h4 class="text-muted">No Certificates Yet</h4> <p class="text-muted">Complete courses to earn certificates!</p> </div> <?php endif; ?> </div> </div> <!-- Eligible Courses for Certificates --> <?php if($eligible_courses->num_rows > 0): ?> <div class="card"> <div class="card-header"> <h5 class="mb-0">Courses Ready for Certification</h5> </div> <div class="card-body"> <div class="row"> <?php while($course = $eligible_courses->fetch_assoc()): ?> <div class="col-md-6 mb-3"> <div class="card"> <div class="card-body"> <div class="d-flex justify-content-between align-items-center"> <div> <h6 class="mb-1"><?php echo $course['title']; ?></h6> <small class="text-muted">Completed on <?php echo date('F j, Y', strtotime($course['completed_at'])); ?></small> </div> <button class="btn btn-success generate-certificate" data-course-id="<?php echo $course['id']; ?>"> Generate Certificate </button> </div> </div> </div> </div> <?php endwhile; ?> </div> </div> </div> <?php endif; ?> </div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <script> // Generate certificate document.querySelectorAll('.generate-certificate').forEach(button => { button.addEventListener('click', function() { const courseId = this.getAttribute('data-course-id'); generateCertificate(courseId); }); }); function generateCertificate(courseId) { fetch('generate-certificate.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: `course_id=${courseId}` }) .then(response => response.json()) .then(data => { if(data.success) { alert('Certificate generated successfully!'); location.reload(); } else { alert('Error generating certificate: ' + data.message); } }); } </script> </body> </html>
/home/users/unlimited/www/nigeria.codeskitter.site/student/certificates.php