View file adminka/payreqs.php

File size: 1.33Kb
<?php
session_name("SESID");
session_start();
include ('../verh.php');

if($_SESSION['pass']!=$adminpass) {exit;}

if (@$_GET['cleannew']) {
	mysql_query("UPDATE inet_payreq SET st=1");
}

if (@$_GET['ok']) {
	$ok=intval($_GET['ok']);
	$a=mysql_fetch_array(mysql_query("SELECT * FROM inet_payreq WHERE id='$ok'"));
	mysql_query("UPDATE inet_payreq SET st=1 WHERE id='$ok'");
	mysql_query("UPDATE inet_sites SET pay=pay+$a[cost], refpay=refpay+$a[refcost] WHERE id='$a[id_site]'");
}

if (@$_GET['all']) {
	$isql="";
	echo "<a href='payreqs.php'>Необработанные</a> <b>Все</b><br/>";
} else {
	$isql=" AND b.st=0";
	echo "<b>Необработанные</b> <a href='payreqs.php?all=1'>Все</a><br/>";
}
echo "<br/>";
$res=mysql_query("SELECT a.*, b.cost, b.id AS rid FROM inet_sites a, inet_payreq b WHERE a.id=b.id_site$isql ORDER BY id DESC");
while ($a=mysql_fetch_array($res)) {
	echo "<a href='view.php?id=$a[id]'>$a[url]</a><br/> $a[wm] $a[cost] руб";
	echo " <a href='payreqs.php?ok=$a[rid]'>[+]</a>";
	echo "<br/>-----<br/>";
}
if (!mysql_num_rows($res)) {
	echo "Записей нет";
}
echo "<br/>";
if (!@$_GET['all'] and mysql_num_rows($res)) {
	echo "<a href='payreqs.php?cleannew=1'>Принять все</a><br/>";
}
echo "<div class=\"info\"/><a href='apanel.php'>Админка</a></div>";

include ('../niz.php');
?>