<?php

if (mysql_result(mysql_query("SELECT COUNT(*) FROM `rekl` WHERE `sel` = '1' AND `time_last` > '".time()."'"),0)>0)
{
$q_rekl=mysql_query("SELECT * FROM `rekl` WHERE `sel` = '1' AND `time_last` > '".time()."' ORDER BY id ASC");
while ($post_rekl = mysql_fetch_assoc($q_rekl))
{

if ($post_rekl['dop_str']==1)
echo "<a target='_blank' href='/go.php?go=$post_rekl[id]'>";
else
echo "<a target='_blank' href='$post_rekl[link]'>";

if ($post_rekl['img']==NULL)echo "$post_rekl[name]";
else echo "<img src='$post_rekl[img]' alt='$post_rekl[name]' />";
echo "</a>\n";
}

}
?>