<?php
	require dirname(__FILE__).'/include/common.inc.php';
	$db->query("UPDATE `".DB_PRE."ads` SET `".DB_PRE."ads`.`views`=`".DB_PRE."ads`.`views`+1 WHERE `".DB_PRE."ads`.`adsposid`=".intval($id),true);
	$str='';
	$handle=@fopen(DIRCMS_ROOT.'data/ads/'.$id.'.html', "r");
	if ($handle) {
		while (!feof($handle)) {
			$buffer = fgets($handle, 4096);
			$buffer=str_replace("
",'',$buffer);
			
			$str.='document.writeln(\''.$buffer.'\');'."
";
		}
		fclose($handle);
	}
	exit($str);
?>