Файл: adv.php
Строк: 17
<?php
include_once ('conf.php');
include_once (MOD_DIR . 'func.php');
include_once INC . "/bd.php";
if($_GET["t"] == "cont"){
$res = mysql_query("SELECT `url`, `passed`, `ordered` FROM `avert-context` WHERE `id` = ".intval($_GET["id"]));
if(mysql_num_rows($res) == 1){
$row = mysql_fetch_assoc($res);
$url = $row["url"];
mysql_query("UPDATE `avert-context` SET `passed` = `passed` + 1 WHERE `id` = ".intval($_GET["id"]));
if($row["passed"] >= $row["ordered"])
mysql_query("DELETE FROM `avert-context` WHERE `id` = ".intval($_GET["id"]));
}else{
$url = "/";
}
}else{
$url = "/";
}
header( 'Refresh: 0; url='.htmlspecialchars($url) );
?>