Certificate System Diagnostics

Rewrite Rules

If certificate download URLs are returning 404 errors, flush the rewrite rules.

Rewrite rules have been flushed!

'; } ?>

Test Certificate Rewrite Rules

Certificate Database

prefix . 'hvac_certificates'; // Check if table exists $table_exists = $wpdb->get_var("SHOW TABLES LIKE '$cert_table'") === $cert_table; if ($table_exists) { $total = $wpdb->get_var("SELECT COUNT(*) FROM $cert_table"); $active = $wpdb->get_var("SELECT COUNT(*) FROM $cert_table WHERE revoked = 0"); $revoked = $wpdb->get_var("SELECT COUNT(*) FROM $cert_table WHERE revoked = 1"); echo "

✅ Certificate table exists

"; echo ""; } else { echo "

❌ Certificate table does not exist!

"; } ?>

Certificate Files

✅ Certificate directory exists: $cert_dir

"; // Count PDF files $pdf_count = count(glob($cert_dir . '/*.pdf')); echo "

Total PDF files: $pdf_count

"; // Check .htaccess if (file_exists($cert_dir . '/.htaccess')) { echo "

✅ .htaccess file exists for security

"; } else { echo "

⚠️ .htaccess file missing - certificates may not be protected

"; } } else { echo "

❌ Certificate directory does not exist!

"; } ?>

Recent Certificate Activity

get_results(" SELECT c.*, p.post_title as event_title FROM $cert_table c LEFT JOIN {$wpdb->posts} p ON c.event_id = p.ID ORDER BY c.generated_date DESC LIMIT 10 "); if ($recent) { echo ''; echo ''; echo ''; foreach ($recent as $cert) { $status = $cert->revoked ? 'Revoked' : 'Active'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
IDEventGeneratedStatus
' . $cert->certificate_id . '' . esc_html($cert->event_title) . '' . date('Y-m-d H:i', strtotime($cert->generated_date)) . '' . $status . '
'; } else { echo '

No certificates found.

'; } } ?>