Файл: public_html/admin/refbirj.php
Строк: 89
<? include('checkcookie.php'); ?>
<h3>Биржа рефералов</h3>
<br>
<?
$res=mysql_query("select price from tb_config where item='refbirjcomm'");
$res=mysql_fetch_array($res);
$comm=$res["price"];
$res=mysql_query("select price from tb_config where item='refbirjminclick'");
$res=mysql_fetch_array($res);
$min=$res["price"];
if($_POST["action"]!="")
{
$action=$_POST["action"];
if($action=='cfg')
{
$comm=$_POST["comm"];
$min=$_POST["min"];
mysql_query("update tb_config set price='$comm' where item='refbirjcomm'");
mysql_query("update tb_config set price='$min' where item='refbirjminclick'");
$num=0;
$res=mysql_query("select * from tb_refbirj order by id asc");
while($row=mysql_fetch_array($res))
{
$id=$row["id"];
$idu=$row["iduser"];
$price=$row["price"];
if($price<$comm)
{
mysql_query("delete from tb_refbirj where id='$id'");
$num=$num+1;
}else{
$rs=mysql_query("select visits from tb_users where id='$idu'");
$rs=mysql_fetch_array($rs);
if($rs["visits"]<$min)
{
mysql_query("delete from tb_refbirj where id='$id'");
$num=$num+1;
}
}
}
echo "<font color=#00cc00><b>Настройки сохранены</b></font><br>";
if($num>0) echo "<font color=#00cc00><b>Было удалено $num пользователей с Биржи рефералов, т.к. они не соответствуют условиям для продажи</b></font><br>";
}
if($action=='delete')
{
$id=$_POST["id"];
mysql_query("delete from tb_refbirj where id='$id'");
echo "<font color=#00cc00><b>Пользователь удален с Биржи рефералов</b></font><br>";
}
}
?>
<form action="" method=post>
<b>Комиссия системы:<b><br>
<input type="text" value="<?=$comm?>" name="comm"><br><br>
<b>Минимум кликов реферала для выставления на продажу:</b><br>
<input type="text" value="<?=$min?>" name="min"><br><br>
<input type=hidden value="cfg" name="action">
<input type="submit" value="Сохранить">
</form>
<br><br>
Рефералы в продаже:<br>
<table width=100% align=center>
<tr>
<th>№</th>
<th>Логин</th>
<th>Продавец</th>
<th>Кликов</th>
<th>Рефералов</th>
<th>Денег на балансе</th>
<th>Статус аккаунта</th>
<th>Регистрация</th>
<th>Последний вход</th>
<th>Цена</th>
<th></th>
</tr>
<?
$res=mysql_query("select * from tb_refbirj order by id asc");
while($row=mysql_fetch_array($res))
{
$id=$row["id"];
$iduser=$row["iduser"];
$price=$row["price"];
$res1=mysql_query("select * from tb_users where id='$iduser'");
$res1=mysql_fetch_array($res1);
$login=$res1["username"];
$seller=$res1["referer"];
$visits=$res1["visits"];
$res2=mysql_query("select count(*) as kolvo from tb_users where referer='$login'");
$res2=mysql_Fetch_array($res2);
$refs=$res2["kolvo"];
$money=$res1["money"];
$account=$res1["account"];
$regdate=$res1["joindate"];
$logdate=$res1["lastlogdate"];
echo "<tr><td align=center>$id</td><td align=center>$login</td><td align=center>$seller</td><td align=center>$visits</td><td align=center>$refs</td>
<td align=center>$money</td><td align=center>$account</td><td align=center>$regdate</td><td align=center>$logdate</td>
<td align=center>$price $vn</td><td align=center>";
?>
<form action="" method="post">
<input type="hidden" value="<?=$id?>" name="id">
<input type="hidden" value="delete" name="action">
<input type="submit" value="Удалить">
</form>
</td></tr>
<?
}
echo "</table>";
?>