Файл: public_html/admin/frameadsreq.php
Строк: 70
<? include('checkcookie.php'); ?>
<h3>Заказы рекламы во фрейме</h3>
<br>
<?
if (isset($_GET["id"]))
{
$id=$_GET["id"];
$option=$_GET["option"];
$wmid=$_POST["wmid"];
$plan=$_POST["plan"];
$linksite=$_POST["linksite"];
$text=$_POST["text"];
$t=time();
$t=$t+$plan*24*3600;
if ($option=="approve")
{
$query = "INSERT INTO tb_frameads (wmid,link,text,enddate) VALUES('$wmid','$linksite','$text','$t')";
mysql_query($query) or die(mysql_error());
$queryz = "DELETE FROM tb_frameadsreq WHERE id='$id'";
mysql_query($queryz) or die(mysql_error());
$res=mysql_query("select * from tb_comp where param='9'");
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_frameadsreq 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>URL</th>
<th>Текст ссылки</th>
<th>Дней для показа</th>
<th></th>
<th></th>
</tr>
<?
$tabla = mysql_query("SELECT * FROM tb_frameadsreq ORDER BY id ASC");
while ($registro = mysql_fetch_array($tabla)) {
echo "
<tr>
<td>". $registro["id"] ."</td>
<td>". $registro["wmid"] ."</td>
<td><a href="". $registro["link"] ."" target="_blank">". $registro["link"] ."</a></td>
<td>". $registro["text"] ."</td>
<td>". $registro["plan"] ."</td>
<td>";
?>
<form method="post" action="adminmain.php?p=frameadsreq&id=<?= $registro["id"] ?>&option=approve">
<input type="hidden" name="plan" value="<?= $registro["plan"] ?>">
<input type="hidden" name="linksite" value="<?= $registro["link"] ?>">
<input type="hidden" name="text" value="<?= $registro["text"] ?>">
<input type="hidden" name="wmid" value="<?= $registro["wmid"] ?>">
<input type="submit" value="Добавить" class="button">
</form>
</td><td>
<form method="post" action="adminmain.php?p=frameadsreq&id=<?= $registro["id"] ?>&option=deny">
<input type="submit" value="Удалить" class="button">
</form>
</td>
</tr>
<?
}
?>
</table>