All pastes #823773 Raw Edit

Untitled

public php v1 · immutable
·published 2007-12-19 16:00 UTC
rendered paste body
$filename = $_GET['c'];// required for IE, otherwise Content-disposition is ignoredif(ini_get('zlib.output_compression'))  ini_set('zlib.output_compression', 'Off');// addition by Jorg Weske$file_extension = strtolower(substr(strrchr($filename,"."),1));if ( $file_extension == 'zip' ) {  if( $filename == "" ) {  echo "<html><title>..{ erro }..</title><body>Ficheiro não encontrado</body></html>";  exit;} elseif ( ! file_exists( $filename ) ) {  echo "<html><title>..{ erro }..</title><body>Ficheiro não encontrado</body></html>";  exit;};switch( $file_extension ){  case "pdf": $ctype="application/pdf"; break;  case "zip": $ctype="application/zip"; break;  default: $ctype="application/force-download";}header("Pragma: public"); // requiredheader("Expires: 0");header("Cache-Control: must-revalidate, post-check=0, pre-check=0");header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype");// change, added quotes to allow spaces in filenames, by Rajkumar Singhheader("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );header("Content-Transfer-Encoding: binary");header("Content-Length: ".filesize($filename));readfile("$filename");exit();} else {print "<html><title>..{ erro }..</title><body>Ficheiro não permitido</body></html>";}