View file public_html/admin/reqautoref.php

File size: 1.51Kb
<? include('checkcookie.php'); ?>
<h3>Запросы на активацию функции Авто-реферал</h3>
<br>

<?
if ($_GET["option"]=="success")
{
	$user=$_POST["username"];
	$plan=$_POST["plan"];
	$id=$_POST["id"];

	$t=time();
	$ed=$t+$plan*7*24*3600;

	$sql="update tb_users set autoref='1',autorefend='$ed' where username='$user'";
	mysql_query($sql);

	mysql_query("delete from tb_autorefreq where id='$id'");

	echo "Готово";
}

if ($_GET["option"]=="cancel")
{
	$id=$_POST["id"];	

	$sql="delete from tb_autorefreq where id='$id'";
	mysql_query($sql);

	echo "Удалено";
}
?>

<table>
<tr>
<th>Имя пользователя</th>
<th>Срок активации</th>
<th></th><th></th>
</tr>
<?
$sql="select * from tb_autorefreq order by id asc";
$res=mysql_query($sql);

if (mysql_num_rows($res)>0)
{
	while ($row=mysql_fetch_assoc($res))
	{
		?><tr><td><?
		echo $row["user"];
		?></td><td><?
		echo $row["plan"];
		?></td>
		<td>
		<form method="post" action="adminmain.php?p=reqautoref&option=success">
		<input type="hidden" name="username" value="<?= $row["user"] ?>">
		<input type="hidden" name="id" value="<?= $row["id"] ?>">
		<input type="hidden" name="plan" value="<?= $row["plan"] ?>">
		<input type="submit" value="Подтвердить" class="button">
		</form>
		</td>
		<td>
		<form method="post" action="adminmain.php?p=reqautoref&option=cancel">
		<input type="hidden" name="id" value="<?= $row["id"] ?>">
		<input type="submit" value="Удалить" class="button">
		</form>
		</td>
		</tr>
		<?
	}
}
?>
</table>