<?PHP
ini_set('max_execution_time', 600000);
error_reporting(0);
$root_path='../../';
include($root_path.'/php/connect_sub.php');
include($root_path.'/php/sub.php');
include($root_path."/php/img_sub.php");
include($root_path.'/admin/check.php');

$swf_active='no';
$file_path=$root_path.'/upload/paper_data/';
$temp_path='/upload/paper_data/';

	//检测是否上传
$inpic=$_FILES['Filedata'];
$MAX_FILE_SIZE=20480000;
if($inpic[name] != "none")
{
		$intime		=	Date("Y-m-d H:i:s");	
		$pictime=gmdate(date(U)).rand(0,99999999);
		$sux=get_sux($inpic[name]);
		$filename=substrgb_old($intime,0,4).'/'.$pictime.".".$sux;
		$sfilename=substrgb_old($intime,0,4).'/s'.$pictime.".".$sux;
		$name=get_filename($inpic[name]);
		$taxis=$db->num_rows($db->query("SELECT id from {$db_sux}papers_upfile where nid='$inid'"));
		$taxis++;
		if($sux == "jpg")
		{
			 	if(!file_exists($file_path.substrgb_old($intime,0,4).'/'))
	      {
	         mkdir($file_path.substrgb_old($intime,0,4).'/',0777);
	      }
				
				$db->query("insert into {$db_sux}papers_upfile(id,nid,name,upfile,supfile,addtime,taxis,size,active)
										VALUES('$pictime','$inid','$name','$filename','$sfilename','$intime','$taxis','$inpic[size]','$active')");
				upload_file($inpic[tmp_name],$file_path.$filename);

				//检测图片是否过大
				$im = @imagecreatefromjpeg($file_path.$filename); 
				$temp_w= ImageSX($im); 
				if($temp_w>1024){HrResize($file_path.$filename,$file_path.$filename,800,600,0,0,0,90);}
				
				HrResize($file_path.$filename,$file_path.$sfilename,496,372,0,0,0,90);//小图
				//make_scale($file_path.$filename,$file_path.$filename,85,$root_path."/images/logo.png");//大图水印	
				$swf_active='ok';
		}
}

echo $swf_active.'||'.$filename.'||'.$inid.'||';
?>