<?php
require('global.php');
initGP(array('id',));


$showad_path = 'data/cache/ad/cache_ad_'.$id.'.htm';
$showad_path_url = 'data/cache/ad/cache_ad_'.$id.'_url.htm';
if (!file_exists($showad_path) || !file_exists($showad_path_url)) {
	$sql = "SELECT * FROM ".$db_tablepre."ad WHERE ad_id=".$id;
	$query = sql_return($sql,2);
	$ad_title = stripslashes(unserialize($query['ad_title']));
	$ad_height = $query['ad_height'];
	$ad_width = $query['ad_width'];
	$cache_data = 'http://'.$web_domin.'/'.$showad_path.'|+|'.$ad_height.'|+|'.$ad_width;
	if ($ad_title) {
		writeover($showad_path, '<div align="center">'.$ad_title.'</div>');
		writeover($showad_path_url, $cache_data);
	}
	else exit('虚位以待');
	
	
}else  $cache_data = file_get_contents($showad_path_url) ;
echo $cache_data;
?>
