示例#1
0
 public function test_echo()
 {
     $result = array("error_code" => 0, "error_desc" => "");
     $user_id = session_auth();
     $this->tpl_name = "//ajax_exe/ajax_result";
     $this->assigns["error_code"] = "0";
     $get = $_GET;
     unset($get["tf_url"]);
     unset($get["session_id"]);
     unset($get["session_key"]);
     $result["result"] = $get;
     echo json_encode($result);
     exit(0);
 }
	POSSIBILITY OF SUCH DAMAGE.
*/
include_once "auth.inc";
include "functions.php";
// Set the cache policy
ob_end_clean();
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Gets the parameters
$_GET['file_name'] = urldecode($_GET['file_name']);
$_GET['p'] = urldecode($_GET['p']);
// Check Authentication
$candownload = false;
$candownload = session_auth();
if ($candownload) {
    if ($_GET['file_name'] && $_GET['p']) {
        $filepath = $_GET['p'] . $_GET['file_name'];
        if (file_exists($filepath)) {
            $type = wp_check_filetype($_GET['file_name']);
            header('Content-type: ' . $type[$_GET['file_name']]);
            header('Content-Disposition: attachment; filename="' . $_GET['file_name'] . '"');
            header('Content-Length: ' . filesize($filepath));
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filepath)) . ' GMT', true, 200);
            flush();
            readfile($filepath);
            exit;
        } else {
            echo "File not found";
        }