|
发表于 2004-5-26 12:19:31
|
显示全部楼层
<?php
// We'll be outputting a binary file
header("Content-type: application/octet-stream");
// It will be called ....
$filename = basename($_GET['fname']);
header("Content-Disposition: attachment; filename=".$filename);
$not_to_be_dloaded = array(".htm", ".html", ".shtml", ".dhtml", ".php");
$extensie = strrchr($_GET['fname'], ".");
if (!in_array(substr($extensie, 1), $not_to_be_dloaded)) {
// the source file is output
readfile($_GET['fname']);
} else {
// message when downloading a forbidden file
echo "$msg_not_allowed";
}
?> |
|