switch ($_REQUEST["type"]) { case "key": $content = $configuration["key"]; $filename = $configuration["label"] . ".key"; break; case "cert": $content = $configuration["crt"]; $filename = $configuration["label"] . ".cert"; break; case "cacert": $content = $configuration["cacrt"]; $filename = $configuration["id"] . ".cert"; break; case "dh": $content = $configuration["dh"]; $filename = $configuration["id"] . ".pem"; break; case "ovpn": $content = getOvpn($configuration); $filename = $configuration["id"] . ".ovpn"; break; } if (!$content) { // echo "null"; header("Location: index.php"); exit; } header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"{$filename}\""); echo $content;
switch ($_REQUEST["type"]) { case "key": $content = $vpn["vpn_key"]; $filename = $vpn["vpn_hash"] . ".key"; break; case "cert": $content = $vpn["vpn_cert"]; $filename = $vpn["vpn_hash"] . ".cert"; break; case "cacert": $content = $vpn["vse_cacert"]; $filename = $vpn["vpn_hash"] . $vpn["vse_id"] . ".cert"; break; case "dh": $content = $vpn["vse_dh"]; $filename = $vpn["vpn_hash"] . $vpn["vse_id"] . ".pem"; break; case "ovpn": $content = getOvpn($vpn); $filename = $vpn["vpn_hash"] . $vpn["vse_id"] . ".ovpn"; break; } if (!$content) { // echo "null"; header("Location: index.php"); exit; } header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"{$filename}\""); echo $content;