[f8]-[Iwan]
Legacy Member
Ik wil dat deze popup sluit na het uitvoeren van alle code, dit wil maar niet lukken...
Ik ben nogal noob als het op php aankomt...
Ik ben nogal noob als het op php aankomt...
PHP:
<?php
//CHECK FOR FILENAME IN QUERTY STRING
if(empty($_GET['file'])) {
exit;
} else {
$file=$_GET['file'];
}
if (strstr($HTTP_USER_AGENT,"MSIE 5.5")) {
$attachment = "";
} else {
$attachment = "attachment;";
}
//VALIDATE FILE TYPES ADD |mp3|wmv after jpg etc.
if (preg_match("/[\/]{0,1}([[:alnum:]-_]{1,30}\.gif|jpg)$/i", $file, $matches)){
$filename=$matches[1];
} else {
echo"File is of invalid type";
exit;
}
//MAKE SURE FILE EXISTS
if (!file_exists($file)){
echo "The file: $file was not found";
exit;
}
//DELIVER THE FILE
if(!$fp = fopen($file, "rb")){
echo "There was a problem opening file: $file";
exit;
} else {
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1 (add "no-cache, no-store" to keep user from downloading content at all)
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// HTTP/1.0
header("Pragma: no-cache");
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download",false);
header("Content-Type: application/download",false);
header("Content-Disposition: $attachment filename=\"$filename\"");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($file) . "\n");
fpassthru($fp);
}
echo "<SCRIPT LANGUAGE=\"JavaScript\">
<!--
window.close();
//-->
</SCRIPT>";
?>

.