<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/adm_check.php';
include_once '../../sys/inc/user.php';


if (user_access('adm_mysql')){
    
 if (mysql_result(mysql_query("SELECT COUNT(*) FROM `build` WHERE `active` = '1' AND `id` = '".intval($_GET['id'])."' LIMIT 1"), 0)==0){
header("Location: index.php?".SID);
exit;
}   
if (isset($_GET['on'])){
mysql_query("UPDATE `build` SET `off` = '0' WHERE `id`='".intval($_GET['id'])."'");
$_SESSION['message'] = 'Стройка успешно включена';
header('location: /build/');    
}else{
mysql_query("UPDATE `build` SET `off` = '1' WHERE `id`='".intval($_GET['id'])."'");
$_SESSION['message'] = 'Стройка успешно отключена';
header('location: /build/');
}
}

?>