<?php 
if (isset($_GET['list_id']) && class_exists('Advertisement'))
{
	// Время хранения информации о показе.
	$count_days = 3;
	
	header ("HTTP/1.0 301 Redirect");
	$Advertisement = new Advertisement();
	
	$location = $Advertisement->ShowBannerIsTrue($_GET['list_id'], $count_days);

	if (!$location && isset($_GET['banner_id']))
	{
		$advertisement_row = $Advertisement->GetAdvertisement($_GET['banner_id']);

		// Баннер найден
		if ($advertisement_row)
		{
			$location = $advertisement_row['advertisement_image_link'];
		}
	}

	if ($location)
	{
		?><script language="javascript">location.href='<?php echo $location?>'</script><?php 
	}
	exit();
}
?>