Файл: public_html/admin/bannerreq.php
Строк: 75
<? include('checkcookie.php'); ?>
<h3>Заказы баннеров</h3>
<br>
<?
if (isset($_GET["id"]))
{
$id=$_GET["id"];
$option=$_GET["option"];
$plan=$_POST["plan"];
$urlsite=$_POST["urlsite"];
$urlpic=$_POST["urlpic"];
$wmid=$_POST["wmid"];
$t=time();
if ($option=="approve"){
$query = "INSERT INTO tb_advban (urlsite,urlpic,begindate,numdays,wmid) VALUES('$urlsite','$urlpic','$t','$plan','$wmid')";
mysql_query($query) or die(mysql_error());
$queryz = "DELETE FROM tb_addbanner WHERE id='$id'";
mysql_query($queryz) or die(mysql_error());
$res=mysql_query("select * from tb_comp where param='8'");
if(mysql_num_rows($res)>0)
{
while($row=mysql_fetch_array($res))
{
$id=$row["id"];
$lidertype=$row["lidername"];
$t=time();
$sd=strtotime($row["startdate"]);
$ed=strtotime($row["enddate"]);
if($t>$sd && $t<$ed)
{
if($lidertype=='0')
{
$res1=mysql_query("select username from tb_users where wmid='$wmid'");
if(mysql_num_rows($res1)>0){$res1=mysql_fetch_array($res1); $lidername=$res1["username"];}else{$lidername='';}
}else{
$lidername=$wmid;
}
if($lidername!='')
{
$res1=mysql_query("select * from tb_compdata where idk='$id' and user='$lidername'");
if(mysql_num_rows($res1)>0)
{
$res1=mysql_Fetch_array($res1);
$resvalue=$res1["resvalue"]+$plan;
$purse='';
mysql_query("update tb_compdata set resvalue='$resvalue', purse='$purse' where id='".$res1["id"]."'");
}else{
$purse='';
mysql_query("insert into tb_compdata (idk,user,resvalue,purse) values ('$id','$lidername','$plan','$purse')");
}
}
}
}
}
echo "<font color="red"><b>Баннер добавлен.</b></font><br><br>";
}
if ($option=="deny"){
$queryz = "DELETE FROM tb_addbanner WHERE id='$id'";
mysql_query($queryz) or die(mysql_error());
echo "<font color="#cc0000"><b>Заказ баннера удален.</b></font><br><br>";
}
}
?>
<table>
<tr>
<th>№</th>
<th>WMID</th>
<th>Дней показа</th>
<th>URL сайта</th>
<th>URL картинки</th>
<th></th>
<th></th>
</tr>
<?
$tabla = mysql_query("SELECT * FROM tb_addbanner ORDER BY id ASC");
while ($registro = mysql_fetch_array($tabla)) {
echo "
<tr>
<td>". $registro["id"] ."</td>
<td>". $registro["wmid"] ."</td>
<td>". $registro["plan"] ."</td>
<td><a href="". $registro["urlsite"] ."" target="_blank">". $registro["urlsite"] ."</a></td>
<td><a href="". $registro["urlpic"] ."" target="_blank">". $registro["urlpic"] ."</a></td>
<td>";
?>
<form method="post" action="adminmain.php?p=bannerreq&id=<?= $registro["id"] ?>&option=approve">
<input type="hidden" name="plan" value="<?= $registro["plan"] ?>">
<input type="hidden" name="urlsite" value="<?= $registro["urlsite"] ?>">
<input type="hidden" name="urlpic" value="<?= $registro["urlpic"] ?>">
<input type="hidden" name="wmid" value="<?= $registro["wmid"] ?>">
<input type="submit" value="Добавить" class="button">
</form>
</td><td>
<form method="post" action="adminmain.php?p=bannerreq&id=<?= $registro["id"] ?>&option=deny">
<input type="submit" value="Удалить" class="button">
</form>
</td>
</tr>
<?
}
?>
</table>