<?php

# 希望您能保留版权 1.3.2
	// include configuration, language and functions
	@include("./indexfiles/config.php");
	@include($langdir.$lang_file);
	@include($incdir."functions.php");
	
	// save new access to log file
	if ($LOG_TRAFFIC) {
		store_file_acc_info(gethostbyaddr($_SERVER['REMOTE_ADDR']), date("Y年n月d日 H:i:s"), $_GET['fname']);
	}

	$fn = $_GET['fname'];
	$fn = stripslashes($fn);
	$fn = str_replace('*', '&', $fn);

	// We'll be outputting a binary file
	header("Content-type: application/octet-stream");
	// It will be called ....
	$filename = basename($fn);
	header("Content-Disposition: attachment; filename=".$filename);


	$not_to_be_dloaded = array(".htm", ".html", ".shtml", ".dhtml", ".php");
	$extensie = strrchr($fn, ".");

	if (!in_array(substr($extensie, 1), $not_to_be_dloaded) && (strpos($fn, "..") === false)) {
		if (strpos($fn, "./") === false || strpos($fn, "./") != 0) {
			// message when downloading a forbidden file
			echo "$msg_not_allowed";
		} else {
			// the source file is output
			readfile($fn);
		}
	} else {
		// message when downloading a forbidden file
		echo "$msg_not_allowed";
	}
/*
	$fn = $_GET['fname'];
	echo "NO OPERATIONS: <b>".$fn."</b><br>";
	$fn = stripslashes($fn);
	echo "NO OPERATIONS: <b>".$fn."</b><br>";
	$fn = str_replace('*', '&', $fn);
	echo "NO OPERATIONS: <b>".$fn."</b><br>";
	//echo "NO OPERATIONS: <b>".$fn."</b><br>";
*/

?>
