<?php

	error_reporting(E_ERROR | E_WARNING | E_PARSE);
	ini_set('error_reporting', E_PARSE);
	ini_set('display_errors',ON);
	ini_set('memory_limit','32M');
	
	require('../pac/package/pb.inc');
	
	//初期値;
	$request = $_REQUEST;

	$pdfhead = '';
	$pdftable = '';
	$pdfcodes = array('ifm'=>'information_mt','bnr'=>'banner','new'=>'news');
	foreach($pdfcodes as $head=>$table)
	{
		if(array_key_exists($head.'_code', $request))
		{
			$pdfhead = $head;
			$pdftable = $table;
		}
	}
	
	if(!$pdfhead)
		exit();
	
	$in = array();
	$in[$pdfhead.'_code'] = $request[$pdfhead.'_code'];
	list($line) = pool::get($pdftable, $in);

	if($line[$pdfhead.'_code'])
	{
		$server_file = './_upimg/topnews/'.$line[$pdfhead.'_pdffile'];
		$file_name = $line[$pdfhead.'_pdfvirtual'];
		if(is_file($server_file))
		{
			ob_end_clean();
			header('Content-type: application/pdf');
			header('Content-Disposition: inline; filename="'.$file_name.'"');
			
			readfile($server_file);
		}
	}
?>
