<? include('header.php'); ?>
     

<br>     
<h3>Просмотр баннеров</h3>
<br>

<fieldset>
<div id="fieldheader"><center>Сообщения от Администрации</center></div>
<br>
<left>

<?
require('config.php');
$sql="select * from tb_adminmess order by id desc limit 3";
$res=mysql_query($sql);
while($row=mysql_fetch_array($res))
{
	echo "<img src=\"images/comment.png\" align=\"middle\">&nbsp;<SPAN style='font-family: \"Tahoma\"; font-size: 10pt; font-weight: bold;'>";
	echo $row["data"];
	echo "</span><SPAN style='font-family: \"Tahoma\"; font-size: 10pt; font-weight: normal;'>";
	echo " - ";
	echo $row["text"];
	echo "</span><br><br>";
}
?>
</left>

</fieldset>

<fieldset>
<div id="fieldheader"><center>Статические ссылки</center></div>
<br>
<left>
<? $leftblock='0';  include('statlinks.php'); ?>
</left>
</fieldset>

<fieldset>
<div id="fieldheader"><center>Динамические баннеры</center></div>
<br>
<font size="2"><b>
<?
require('config.php');

$sd=date("d.m.Y",time());
$vd=date("d.m.Y",time()-24*3600);

$s=0; $v=0;

$res=mysql_query("select kolvo from tb_adsdate1 where data='$sd'");
$res=mysql_fetch_array($res);
if($res["kolvo"]!='') $s=$res["kolvo"];

$res=mysql_query("select kolvo from tb_adsdate1 where data='$vd'");
$res=mysql_fetch_array($res);
if($res["kolvo"]!='') $v=$res["kolvo"];

mysql_close($con);

echo "Сегодня новых баннеров: $s шт.<br>Вчера было новых баннеров: $v шт.";
?>
</b></font>
<br>
<font size="2"><b>Всего баннеров для просмотра: 
<?
require('config.php');
$sql="select * from tb_ads1 where tipo='ads'";
$res=mysql_query($sql);
$kol=0;
if(mysql_num_rows($res)>0)
{
	while($cr=mysql_fetch_array($res))
	{
		if($cr["members"]>=$cr["plan"])
		{
			$id=$cr["id"];
			$sql="delete from tb_ads1 where id='$id'";
			mysql_query($sql) or die(mysql_error());
		}else{
			$kol=$kol+1;
		}
	}
}

echo "$kol шт.";

mysql_close($con);
?>




<br>
<center><span style="color:#ff0000;"><b>VIP реклама</b></span></center>
<div id="tables">
<table width="10%" align="center">
<tr>
<th class="top" width="10%">
<b>Описание сайта</b>
</th>
<th class="top" width="1%">
<div align="center">
Просм</div>
</th>
<th class="top" width="10%">
<div align="center">
Заказ</div>
</th>


<?
if(isset($_SESSION["username"]) && isset($_SESSION["password"])) { $tit=""; }else{ $tit="1"; }

require('config.php');
$sql = "SELECT * FROM tb_ads1 WHERE tipo='ads' and vip='1' ORDER BY fechainicia DESC";
$rs = mysql_query($sql, $con);
mysql_close($con);

if(mysql_num_rows($rs)>0)
{
	$template = implode("", file("titulos1.php"));

	while($row = mysql_fetch_assoc($rs))
	{
		if($tit=="") $row["last"]=uc($_SESSION["username"]);
		$row["total"]=$row["members"]+$row["outside"];

		$highlight=$row["highlight"];
		if ($highlight=="1")
		{
			$row["highlight"]="#ffff00";
			$row["highlight"]="#ffff00";
					}
		$ji=$row["members"];
		$jo=$row["plan"];
		if ($ji < $jo)
		{
		        mostrarTemplate($template, $row);
		}
	}
}

?>
</table>
</div>

<br>
<center><span style="color:#ff0000;"><b>Обычная реклама</b></span></center>

<div id="tables">
<table width="10%" align="center">
<tr>
<th class="top" width="10%">
<b>Описание сайта</b>
</th>
<th class="top" width="1%">
<div align="center">
Просм</div>
</th>
<th class="top" width="10%">
<div align="center">
Заказ</div>
</th>


<?
if(isset($_SESSION["username"]) && isset($_SESSION["password"])) { $tit=""; }else{ $tit="1"; }

require('config.php');
$sql = "SELECT * FROM tb_ads1 WHERE tipo='ads' and vip='0' ORDER BY fechainicia DESC";
$rs = mysql_query($sql, $con);
mysql_close($con);

if(mysql_num_rows($rs)>0)
{
	$template = implode("", file("titulos1.php"));

	while($row = mysql_fetch_assoc($rs))
	{
		if($tit=="") $row["last"]=uc($_SESSION["username"]);
		$row["total"]=$row["members"]+$row["outside"];

		$highlight=$row["highlight"];
		if ($highlight=="1")
		{
			$row["highlight"]="#ffff00";
			$row["highlight"]="#ffff00";
					}
		$ji=$row["members"];
		$jo=$row["plan"];
		if ($ji < $jo)
		{
		        mostrarTemplate($template, $row);
		}
	}
}

?>
</table>
</div>

</fieldset>

<fieldset>
<center>
<div id="fieldheader"><center>Ротатор баннеров</center></div>
<br>
<? include('rotator.php'); ?>
<br>
<b>Баннеров в ротаторе: <? echo $kol; ?></b>
</center>
</fieldset>

<? include('footer.php'); ?>