View file public_html/admin/requpgrade.php

File size: 1.74Kb
<? include('checkcookie.php'); ?>
<h3>Заказы апгрейдов</h3>
<br>

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

	if($srok!="0") $ed=time()+$srok*30*24*3600;
	if($srok=="0") $ed='';

	$sql="update tb_upgrade set enddate='$ed', requpgrade='0'  where id='$id'";
	mysql_query($sql);

	mysql_query("update tb_users set account='V.I.P.' where username='$user'");

	echo "Готово";
}

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

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

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

<table>
<tr>
<th>Пользователь</th>
<th>Срок апгрейда</th>
<th></th><th></th>
</tr>
<?
$sql="select * from tb_upgrade where requpgrade='1' 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><?
		if($row["srok"]=="1") echo "на 1 месяц";
		if($row["srok"]=="2") echo "на 2 месяца";
		if($row["srok"]=="3") echo "на 3 месяца";
		if($row["srok"]=="6") echo "на 6 месяцев";
		if($row["srok"]=="0") echo "Пожизненный";
		?></td>
		<td>
		<form method="post" action="adminmain.php?p=requpgrade&option=success">
		<input type="hidden" name="username" value="<?= $row["user"] ?>">
		<input type="hidden" name="srok" value="<?= $row["srok"] ?>">
		<input type="hidden" name="id" value="<?= $row["id"] ?>">
		<input type="submit" value="Подтвердить" class="button">
		</form>
		</td>
		<td>
		<form method="post" action="adminmain.php?p=requpgrade&option=cancel">
		<input type="hidden" name="id" value="<?= $row["id"] ?>">
		<input type="submit" value="Удалить" class="button">
		</form>
		</td>
		</tr>
		<?
	}
}
?>
</table>