Invalid plan type selected!"; } else { // Generate the two 4-character serial segments $serial1 = generate_random_alphanumeric(4); $serial2 = generate_random_alphanumeric(4); // Assemble the full license key $license_key = "WBPN-{$plan_code}-{$serial1}-{$serial2}"; try { // Prepare and execute the SQL query to insert the new key into the 'licenses' table // The status is initially 'inactive' as it hasn't been activated by a plugin installation yet. $stmt = $pdo->prepare("INSERT INTO licenses (license_key, plan_type, serial1, serial2, status) VALUES (?, ?, ?, ?, 'inactive')"); $stmt->execute([$license_key, $plan_code, $serial1, $serial2]); // Set success message and store the generated key for display $message = "
Key | Plan | Status | Domain | Expires | Created |
---|---|---|---|---|---|
" . htmlspecialchars($license['license_key']) . " | "; echo "" . htmlspecialchars($license['plan_type']) . " | "; echo "" . htmlspecialchars($license['status']) . " | "; echo "" . htmlspecialchars($license['activated_on_domain'] ?? 'N/A') . " | "; echo "" . ($license['expiry_date'] ? htmlspecialchars(date('Y-m-d', strtotime($license['expiry_date']))) : 'N/A') . " | "; echo "" . htmlspecialchars(date('Y-m-d H:i', strtotime($license['created_at']))) . " | "; echo "
No licenses found. |