<?php 
if (isset($_GET['list_id']))
{
	// Время хранения информации о показе.
	$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)
	{
		header('Location: '.$location);
	}
}
exit();
?>