<?php
session_start();
if ($_SESSION['uid'] == null) {
    header("Location: index.php");
}
include("config.php");
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1"));
$klan = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1"));
$digger = mysql_fetch_array(mysql_query("SELECT * FROM `digger` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1"));
include("functions.php");
$tm = time();

if ($user['battle'] != 0) {
    header('location: fbattle.php');
    die();
}
if ($user['in_tower'] == 1) {
    header('Location: towerin.php');
    die();
}
if ($user['zayavka'] != 0) {
    die();
}

//$ch_raw = mysql_fetch_array(mysql_query("SELECT `id`, `status` FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1"));
//if ($ch_raw["status"] > 0 && $ch_raw["status"] < 5) {
//    header('location: c_haos_in.php');
//    die();
//}

$dig_raw = mysql_fetch_array(mysql_query("SELECT `id`, `finish_dig`, `finish_guard` FROM `digger` WHERE `id` = '{$user['id']}' LIMIT 1"));
if ($dig_raw["finish_dig"] > $tm || $dig_raw["finish_guard"] > $tm) {
    header('location: wall_build.php');
    die();
}

header("Cache-Control: no-cache");

$d = mysql_fetch_array(mysql_query("SELECT SUM(`massa`) AS `mass` FROM `inventory` WHERE `owner` = '{$user['id']}' AND `dressed` = 0 AND `setsale` = 0"));
if ($d['mass'] > get_meshok() && $_GET['got']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['got'] = 0;
}

$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) > 0 && $_GET['got']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['got'] = 0;
}

$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['got']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['got'] = 0;
}

if ($d['mass'] > get_meshok() && $_GET['strah']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['strah'] = 0;
}

$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) > 0 && $_GET['strah']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['strah'] = 0;
}

$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['strah']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['strah'] = 0;
}

if ($_GET['strah']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '21',`online`.`room` = '21' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
echo mysql_error();
?>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <meta content="text/html; charset=utf-8" http-equiv="Content-type"/>
    <meta http-equiv="Cache-Control" content="no-cache, max-age=0, must-revalidate, no-store"/>
    <meta http-equiv="PRAGMA" content="NO-CACHE"/>
    <meta http-equiv="Expires" content="0"/>
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("<script>function cityg() { location.href = 'city.php'; } setTimeout('cityg()', 5000);</script><center><br /><br /><img src='i/ajax-loader.gif'><br /><i>Переходим на Страшилкину Улицу...</i></center>");
}

if ($d['mass'] > get_meshok() && $_GET['cp']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['cp'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['cp']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['cp'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['cp']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['cp'] = 0;
}


if ($_GET['cp']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '20',`online`.`room` = '20' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
?>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="css/main.css"/>
    <meta content="text/html; charset=utf-8" http-equiv="Content-type">
    <meta http-equiv="Cache-Control" Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv="pragma" content="NO-CACHE">
    <meta Http-Equiv="Expires" Content="0">
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Центральную площадь...</i>
			</center>
		");
}

if ($d['mass'] > get_meshok() && $_GET['bps']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['bps'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['bps']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['bps'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['bps']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['bps'] = 0;
}


if ($_GET['bps']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '26',`online`.`room` = '26' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>

<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Большую Парковую улицу...</i>
			</center>
		");
}

// Ристалище
if ($d['mass'] > get_meshok() && $_GET['zamk']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['zamk'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['zamk']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['zamk'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['zamk']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['zamk'] = 0;
}


if ($_GET['zamk']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2601',`online`.`room` = '2601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Замковую площадь...</i>
			</center>
		");
}

// Ристалище
if ($d['mass'] > get_meshok() && $_GET['zaliv']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['zaliv'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['zaliv']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['zaliv'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['zaliv']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['zaliv'] = 0;
}


if ($_GET['zaliv']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2111',`online`.`room` = '2111' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>


<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Ристалище...</i>
			</center>
		");
}

//Парковая Улица
if ($d['mass'] > get_meshok() && $_GET['ps']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['ps'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['ps']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['ps'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['ps']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['ps'] = 0;
}


if ($_GET['ps']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '51',`online`.`room` = '51' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");


?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Парковую улицу...</i>
			</center>
		");
}

//Торговая улица
if ($d['mass'] > get_meshok() && $_GET['torg']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['torg'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['torg']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['torg'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['torg']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['torg'] = 0;
}


if ($_GET['torg']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2702',`online`.`room` = '2702' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");


?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Торговую улицу...</i>
			</center>
		");
}

//Торговая улица
if ($d['mass'] > get_meshok() && $_GET['abog']) {
    echo "<center><font color=red><b>У вас переполнен рюкзак, вы не можете передвигаться...</b></font></center>";
    $_GET['abog'] = 0;
}
$entangle = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND `type` = 10 LIMIT 1"));
if (isset($entangle['id']) && $_GET['abog']) {
    echo "<center><font color=red><b>Вы парализованы и не можете передвигаться...</b></font></center>";
    $_GET['abog'] = 0;
}
$eff = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '" . $user['id'] . "' AND (`type` = 14 OR `type` = 13) LIMIT 1"));
if (isset($eff['id']) && $_GET['abog']) {
    echo "<center><font color=red><b>У вас тяжелая травма, вы не можете передвигаться...</b></font></center>";
    $_GET['abog'] = 0;
}


if ($_GET['abog']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2655',`online`.`room` = '2655' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");


?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=#d4d4d4>
<?php
die("
			<script>
				function cityg(){
					location.href='city.php';
				}
				setTimeout('cityg()', 5000);
			</script>
			<center><BR><BR><img src='i/ajax-loader.gif'><BR>
				<i>Переходим на Арену Богов...</i>
			</center>
		");
}

if ($user['room'] == 20) {
    // CP
    // BK
    if ($_GET['got'] && $_GET['level1']) {
        //if ($user['level'] > 0) { $room = 8; } else { $room = 1; }
        //mysql_query("UPDATE `users`,`online` SET `users`.`room` = '{$room}',`online`.`room` = '{$room}' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: main.php?setch=1');
        die();
    }
    // Stralka strah
    if ($_GET['got'] && $_GET['level7']) {
        header('location: city.php?strah=1');
    }
    if ($_GET['got'] && $_GET['level8']) {
        header('location: city.php?bps=1');
    }
    if ($_GET['got'] && $_GET['level222']) {
        header('location: city.php?torg=1');
    }
    // shop
    if ($_GET['got'] && $_GET['level17']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '50',`online`.`room` = '50' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: ashop.php');
    }

    // shop
    if ($_GET['got'] && $_GET['level2']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '22',`online`.`room` = '22' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: shop.php');
    }
    // repait
    if ($_GET['got'] && $_GET['level4']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '23',`online`.`room` = '23' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: repair.php');
    }
    if ($_GET['got'] && $_GET['level10']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '35',`online`.`room` = '35' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: krshop.php');
    }


    if ($_GET['got'] && $_GET['level13']) {
        header('location: quest_room.php');
    }


    if ($_GET['got'] && $_GET['level9']) {
        if ($user['align'] == 4) {
            print "<script>alert('Хаосникам вход к памятнику запрещен!')</script>";
        } elseif ($user['level'] < 2) {
            print "<script>alert('Вход к памятнику со 2 уровня!')</script>";
        } else {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '24',`online`.`room` = '24' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: elka.php');
        }
    }


    if ($_GET['got'] && $_GET['level6']) {
        if ($user['level'] < 1) {
            print "<script>alert('Вход на почту только с первого уровня!')</script>";
        } else {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '27',`online`.`room` = '27' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: post.php');
        }
    }

    if ($_GET['got'] && $_GET['level3']) {
        if ($user['align'] == 4) {
            print "<script>alert('Хаосникам вход в комиссионный магазин запрещен!')</script>";
        } elseif ($user['level'] < 1) {
            print "<script>alert('Вход в комиссионный магазин только с первого уровня!')</script>";
        } else {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '25',`online`.`room` = '25' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: comission.php');
        }
    }
} elseif ($user['room'] == 21) {
    // Strashilka
    // strelka cp
    if ($_GET['got'] && $_GET['level4']) {
        header('location: city.php?cp=1');
    }
    // strelka zaliv
    if ($_GET['got'] && $_GET['level3']) {
        header('location: city.php?zaliv=1');
    }
    if ($_GET['got'] && $_GET['level13']) {
        if ($user['align'] == 4) {
            print "<script>alert('Хаосникам вход к памятнику запрещен!')</script>";
        } else {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '34',`online`.`room` = '34' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: fshop.php');
        }
    }


    if ($_GET['got'] && $_GET['level5']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '29',`online`.`room` = '29' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: bank.php');
    }
    if ($_GET['got'] && $_GET['level16']) {
        $effs = mysql_fetch_array(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '{$user['id']}' AND `type` = '21' LIMIT 1"));
        if (isset($effs['id']))
            print "<script>alert('Вход в БС под действием Силы Нейтралитета запрещен!')</script>";
        else {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '31',`online`.`room` = '31' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: tower.php');
        }
        print "<script>alert('На реконструкции!')</script>";
    }


    if ($_GET['got'] && $_GET['level14']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '30',`online`.`room` = '30' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: klanedit.php');
    }


    if ($_GET['got'] && $_GET['level650']) {
        print "<script>alert('Нет прохода!')</script>";
        //	mysql_query("UPDATE `users`,`online` SET `users`.`room` = '650',`online`.`room` = '650' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        //		header('location: ul_clans.php');
    }
} elseif ($user['room'] == 2111) {
    // залив
    // strelka cp
    if ($_GET['got'] && $_GET['level1']) {
        header('location: city.php?strah=1');
    }
    if ($_GET['got'] && $_GET['level2']) {
        header('location: city.php?haos=1');
    }
    if ($_GET['got'] && $_GET['level3']) {
        print "<script>alert('Покапавшись среди водорослей Вы нашли кулeчек и в нем было...')</script>";
        $_SESSION['usebochka'] = '1';

    }
    if ($_GET['got'] && $_GET['level203']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1055',`online`.`room` = '1055' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: group_arena.php');
    }
    if ($_GET['got'] && $_GET['room666']) {
        header('location: jail.php');
    }
    if ($_GET['got'] && $_GET['level1000']) {
        #mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1000',`online`.`room` = '1000' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        #header('location: /solib/enterbezdna.php');
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '620',`online`.`room` = '620' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: enter_cave.php');

    }
    if ($_GET['got'] && $_GET['room666']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '666',`online`.`room` = '666' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: jail.php');
    }

    if ($_GET['got'] && $_GET['level5']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '203',`online`.`room` = '203' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: church.php');
    }


} elseif ($user['room'] == 2601) {
    // zamkovaya
    // strelka bps
    if ($_GET['level4']) {
        header('location: city.php?bps=1');
    }
    if ($_GET['level55']) {
        header('location: city.php?abog=1');
    }
    if ($_GET['got'] && $_GET['level21']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '87',`online`.`room` = '87' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: dshop.php');
    }
    if ($_GET['got'] && $_GET['level10']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '35',`online`.`room` = '35' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: krshop.php');
    }
    if ($_GET['got'] && $_GET['level44']) {
        //	if($user['login'] == 'SaulDin' || $user['login'] == 'Дед мазай'){
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '203',`online`.`room` = '203' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: church.php');
        //	}else{
        //		print "<script>alert('На реконструкции!')</script>";
        //}
    }
    if ($_GET['got'] && $_GET['level1']) {
        if ($user['login'] == 'SaulDin' || $user['login'] == 'Дед мазай') {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '37',`online`.`room` = '37' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: gotzamok.php');
        } else {
            print "<script>alert('Разрушен!')</script>";
        }
    }
    if ($_GET['got'] && $_GET['level1052']) {
        if ($user['level'] >= 4) {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1053',`online`.`room` = '1053' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('Location: rep_shop.php');
        } else {
            echo '<script>alert(\'Вы не можете пройти. Уровень маловат ...\');</script>';
        }
    }
    if ($_GET['got'] && $_GET['level1051']) {
        if ($user['level'] >= 4) {
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1051',`online`.`room` = '1051' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('Location: lab_enter.php');
        } else {
            echo '<script>alert(\'Вы не можете пройти. Уровень маловат ...\');</script>';
        }
    }
    if ($_GET['got'] && $_GET['level5']) {
        //  			    if($user['login'] == 'eXecuTTer' || $user['login'] == 'GOLD' || $user['login'] == 'Дед Мазай'  || $user['align'] == '2.2'){
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '404',`online`.`room` = '404' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: vxod.php');
        //               }else
        //               {
        //				print "<script>alert('Пещера на реконструкции!')</script>";
        //			}
    }
} elseif ($user['room'] == 2701) {
    if ($_GET['level1']) {
        header('location: city.php?zaliv=1');
    }
    if ($_GET['level2']) {
//			if($user['login'] == 'eXecuTTer' || $user['login'] == 'GOLD' || $user['login'] == 'Слёзы' || $user['login'] == '69' || $user['login'] == 'Дед Мазай' || $user['login'] == 'SHEFF'){
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '402',`online`.`room` = '402' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: lab_chaos_enter.php');
//				}else{
//					print "<script>alert('Пещера на реконструкции!')</script>";
//				}	
    }
} //Торговая улица
elseif ($user['room'] == 2702) {
    if ($_GET['got'] && $_GET['level10']) {
        header('location: city.php?cp=1');
    }
    if ($_GET['got'] && $_GET['level202']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1054',`online`.`room` = '1054' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: fontan_luck.php');
    }

    if ($_GET['level5']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '1054',`online`.`room` = '1054' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: fontan.php');
    }
    if ($_GET['level6']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '61',`online`.`room` = '61' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: akadem.php');
//			}else{
//					print "<script>alert('Пещера на реконструкции!')</script>";
//				}	
    }
} //Арена Богов
elseif ($user['room'] == 2655) {
    if ($_GET['got'] && $_GET['level10']) {
        header('location: city.php?zamk=1');
    }
    if ($_GET['got'] && $_GET['level2055']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '603',`online`.`room` = '603' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: aren_of_angels.php');
    }

} elseif ($user['room'] == 26) {
    // Strashilka
    // strelka cp
    if ($_GET['level4']) {
        header('location: city.php?cp=1');
    }
    if ($_GET['got'] && $_GET['level5']) {
        //  print "<script>alert('Нанюхался трав. Пересматривает формулы')</script>";
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '43',`online`.`room` = '43' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: znahar.php');

    }
    if ($_GET['got'] && $_GET['level660']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '660',`online`.`room` = '660' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: hostel.php');
    }
    if ($_GET['got'] && $_GET['level20']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '223',`online`.`room` = '223' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: bench.php');
    }
    if ($_GET['got'] && $_GET['level21']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '222',`online`.`room` = '222' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: bench_s.php');
    }
    if ($_GET['got'] && $_GET['level22']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '224',`online`.`room` = '224' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: bench_m.php');
    }
    if ($_GET['got'] && $_GET['level7']) {
        if ($user['login'] == 'eXecuTTer' || $user['login'] == 'GOLD' || $user['login'] == 'Дед Мазай' || $user['align'] == '2.2') {
//                print "<script>alert('Нужно строит, ждем бригаду строителей...')</script>"; 
            mysql_query("UPDATE `users`,`online` SET `users`.`room` = '777',`online`.`room` = '777' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
            header('location: obshaga.php');
        } else {
            print "<script>alert('Нужно строит, ждем бригаду строителей...')</script>";
        }
    }
    if ($_GET['got'] && $_GET['level3']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '2601',`online`.`room` = '2601' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: city.php?zamk=1');
    }


    if ($_GET['got'] && $_GET['level11']) {
        mysql_query("UPDATE `users`,`online` SET `users`.`room` = '42',`online`.`room` = '42' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        header('location: lotery.php');
    }
    if ($_GET['got'] && $_GET['level6']) {
        // mysql_query("UPDATE `users`,`online` SET `users`.`room` = '110',`online`.`room` = '110' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
        // header('location: jackill.php');
        print "<script>alert('Закрыто.')</script>";
    }
    //if ($_GET['got'] && $_GET['level5']) {
    //mysql_query("UPDATE `users`,`online` SET `users`.`room` = '401',`online`.`room` = '401' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
    //header('location: hell.php');
    //}

}
/*if ($_GET['level7'] OR $_GET['strah']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '21',`online`.`room` = '21' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
$user['room'] = 21;
}
if ($_GET['level8'] && $_GET['strah']) {
mysql_query("UPDATE `users`,`online` SET `users`.`room` = '20',`online`.`room` = '20' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}' ;");
$user['room'] = 20;
}*/
$online = mysql_query("SELECT * FROM `online`  WHERE `real_time` >= " . (time() - 60) . "");
?>
<HTML>
<HEAD>
    <link rel=stylesheet type="text/css" href="css/main.css">
    <link rel="stylesheet" type="text/css" href="/locations/style.css"/>
    <meta content="text/html; charset=utf-8" http-equiv=Content-type>
    <META Http-Equiv=Cache-Control Content=no-cache>
    <meta http-equiv=PRAGMA content=NO-CACHE>
    <META Http-Equiv=Expires Content=0>
    <META HTTP-EQUIV="imagetoolbar" CONTENT="no">
    <style>
        IMG.aFilter {
            filter: Glow(Color=d7d7d7, Strength=9, Enabled=0);
            cursor: pointer
        }
    </style>
    <script type="text/javascript">
        function solo(n) {
            top.changeroom = n;
            window.location.href = 'city.php?got=1&level' + n + '=1';
        }

        function imover(im) {
            im.filters.Glow.Enabled = true;
            //	im.style.visibility="hidden";
        }

        function imout(im) {
            im.filters.Glow.Enabled = false;
            //	im.style.visibility="visible";
        }

        function Down() {
            top.CtrlPress = window.event.ctrlKey
        }

        document.onmousedown = Down;
    </script>
</HEAD>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor="#d7d7d7">
<TABLE width=100% height=100% border=0 cellspacing="0" cellpadding="0">
    <TR>
        <TD align=center></TD>
        <TD align=right>Сейчас в игре : <?= mysql_num_rows($online) ?> чел. <input type="button" value="Подсказка"
                                                                                   style="background-color: #A9AFC0; margin-top: 0px; margin-left: 23px; margin-right: 20px;"
                                                                                   onclick="window.open('help/city1.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')"/>
        </TD>
    </TR>
    <TR>
        <TD align=center colspan=2><?

            function buildset($id, $img, $top, $left, $des)
            {
                //$imga = ImageCreateFromGif("i/city/sub/".$img.".png");
                #Get image width / height
                //$x = ImageSX($imga);
                //$y = ImageSY($imga);
                unset($imga);
                echo "<div style=\"position:absolute; left:{$left}px; top:{$top}px;  z-index:90;\"><img src=\"i/city/sub/{$img}.png\"  alt=\"{$des}\" title=\"{$des}\" class=\"aFilter2\" onmouseover=\"this.src='i/city/sub/{$img}2.png'\" onmouseout=\"this.src='i/city/sub/{$img}.png'\"
                            id=\"{$id}\" onclick=\"solo({$id})\" /></div>";
            }

            function buildset1($id, $img, $top, $left, $des)
            {
                //$imga = ImageCreateFromGif("i/city/sub/".$img.".png");
                #Get image width / height
                //$x = ImageSX($imga);
                //$y = ImageSY($imga);
                unset($imga);
                echo "<div style=\"position:absolute; left:{$left}px; top:{$top}px;  z-index:90;\"><img src=\"i/city/sub/{$img}.gif\"  alt=\"{$des}\" title=\"{$des}\" class=\"aFilter2\" onmouseover=\"this.src='i/city/sub/{$img}2.gif'\" onmouseout=\"this.src='i/city/sub/{$img}.gif'\"
                            id=\"{$id}\" onclick=\"solo({$id})\" /></div>";
            }

            if ($user['room'] == 20) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_cp_day';
                    $fon = 'zima_cap_cp_day';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_cp_night';
                    $fon = 'zima_cap_cp_night';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(1,"vesna_cap_club",30,235,"Бойцовский Клуб");
                buildset(1, "zima_club", 30, 235, "Бойцовский Клуб");
                // buildset(2,"vesna_cap_shop",202,171,"Магазин");
                buildset(2, "zima_shop", 202, 171, "Магазин");
                //buildset(3,"vesna_cap_kom",205,105,"Комиссионный магазин");
                buildset(3, "zima_kom", 205, 105, "Комиссионный магазин");
                // buildset(4,"vesna_cap_rem",202,290,"Ремонтная мастерская");;
                buildset(4, "zima_rem", 202, 290, "Ремонтная мастерская");;
                buildset(13, "vesna_cap_statue", 222, 365, "Памятник Мэру Города");
                //buildset(5,"2pm",210,430,"Памятник");
                //buildset(6,"vesna_cap_po4ta",180,540,"Почта");
                buildset(6, "zima_po4ta", 180, 540, "Почта");
                //buildset(7,"arr_right_png",260,710,"Страшилкина Улица");
                buildset(7, "zima_cap_arr_right", 260, 710, "Страшилкина Улица");
                //buildset(222,"cp_u2_png",180,650,"Торговая улица");
                buildset(222, "zima_cap_arr_top", 180, 650, "Торговая улица");
                //buildset(8,"arr_left_png",258,21,"Большая парковая улица");
                buildset(8, "zima_cap_arr_left", 258, 21, "Большая парковая улица");
                //buildset(12,"vesna_cap_berezka",205,435,"Березка");
                buildset(17, "zima_berezka", 205, 435, "Березка");
                //buildset(11,"vesna_cap_loto",230,615,"Лотерея Сталкера");
                buildset(11, "zima_loto", 230, 615, "Лотерея Сталкера");
                buildset1(9, "tree2", 260, 530, "Новогодняя елка");
                buildset(14, "sneg_3", 210, 390, "Снеговик");
                //buildset(111,"vesna_cap_stella",260,530,"Доска объявления");
                //buildset(111,"zima_stella",260,530,"Доска объявления");


                echo "</div></td></tr></table>";
            } //buildset(9,"fir",137,235,"Новогодняя елка");
            elseif ($user['room'] == 21) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_strash_day';
                    $fon = 'zima_cap_strash_day';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_strash_night';
                    $fon = 'zaim_cap_strash_night';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(5,"vesna_cap_bank",180,485,"Банк");;
                buildset(5, "zima_cap_bank", 180, 485, "Банк");;
                //buildset(2,"vesna_cap_registratura",170,113,"Регистратура кланов");
                buildset(14, "zima_cap_registratura", 170, 113, "Регистратура кланов");
                //buildset(7,"vesna_cap_tower",5,315,"Башня смерти");
                buildset(16, "zima_cap_tower", 5, 315, "Башня смерти");
                //buildset(16555,"tree_png",165,20,"Дерево");
                buildset(16555, "zima_cap_tree", 165, 20, "Дерево");
                //buildset(3,"arr_right_png",255,708,"Ристалище");
                buildset(3, "zima_cap_arr_right", 255, 708, "Ристалище");
                //buildset(3,"2strelka",250,720,"Берег залива");
                //buildset(6,"vesna_cap_flowershop",220,613,"Цветочный магазин");
                buildset(13, "zima_cap_flowershop", 220, 613, "Цветочный магазин");
                //buildset(4,"arr_left_png",258,21,"Центральная площадь");
                buildset(4, "zima_cap_arr_left", 258, 21, "Центральная площадь");
                //buildset(22,"obshga",150,630,"Общежитие");
                echo "</div></td></tr></table>";
            } elseif ($user['room'] == 26) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_park_day';
                    $fon = 'zima_cap_park_day';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_park_night';
                    $fon = 'zima_cap_park_night';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(6,"cap_gate",170,340,"Городские ворота");
                buildset(6, "zima_cap_gate", 170, 340, "Городские ворота");
                //buildset(444,"vesna_cap_vokzal",163,43,"Вокзал");
                buildset(660, "zima_cap_vokzal", 163, 43, "Общежитие");
                //buildset(5,"vesna_cap_znah",195,538,"Хижина Знахаря");
                buildset(5, "zima_cap_znah", 195, 538, "Хижина Знахаря");
                //buildset(20,"vesna_cap_2sk",249,416,"Средняя скамейка");
                buildset(21, "zima_cap_2sk", 249, 416, "Средняя скамейка");
                //buildset(18,"vesna_cap_3sk",250,630,"Большая скамейка");
                buildset(20, "zima_cap_3sk", 250, 630, "Большая скамейка");
                //buildset(20,"vesna_cap_1sk",228,490,"Маленькая скамейка");
                buildset(22, "zima_cap_1sk", 228, 490, "Маленькая скамейка");
//                          //buildset(7,"ava_vokzal",160,235,"Общежитие");
                //buildset(11,"loto_stalkers",240,160,"Лотерея Сталкеров");
                //buildset(3,"arr_left_png",259,27,"Замковая площядь");
                buildset(3, "zima_cap_arr_left", 259, 27, "Замковая площядь");
                //buildset(4,"arr_right_png",259,715,"Центральная площадь");
                buildset(4, "zima_cap_arr_right", 259, 715, "Центральная площадь");
                echo "</div></td></tr></table>";
            } elseif ($user['room'] == 2601) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_park_day';
                    $fon = 'zima_cap_zamk_day';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_zamk_night';
                    $fon = 'zima_cap_zamk_night';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(21,"vesna_cap_lavka",240,425,"Храмовая лавка");
                buildset(1052, "zima_cap_lavka", 240, 425, "Храмовая лавка");
                buildset(10, "ava_post", 240, 300, "Сувенирный магазинчик");
                //buildset(1,"vesna_cap_ruins",166,48,"Руины Старого замка");
                buildset(1, "zima_cap_ruins", 166, 48, "Руины Старого замка");
                //buildset(5,"vesna_cap_lab",130,327,"Вход в Лабиринт Хаоса");
                buildset(1051, "zima_cap_lab", 130, 327, "Вход в Лабиринт Хаоса");
                //buildset(44,"vesna_cap_hram",173,550,"Храм Древних");
                buildset(44, "zima_cap_hram", 173, 550, "Храм Древних");
                //buildset(227,"arr_left_png",258,21,"Арена Богов");
                buildset(55, "zima_cap_arr_left", 258, 21, "Арена Богов");
                //buildset(4,"arr_right_png",260,710,"Большая парковая улица");
                buildset(4, "arr_right_png", 260, 710, "Большая парковая улица");
                echo "</div></td></tr></table>";
            } elseif ($user['room'] == 2655) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_park_day';
                    $fon = 'ar_e_n';
                    //$fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_zamk_night';
                    $fon = 'ar_e_n';
                    //$fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                //echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/",$fon2,".gif\" alt=\"\" border=\"50\"/>";
                //buildset(21,"vesna_cap_lavka",240,425,"Храмовая лавка");
                buildset(2055, "altr_g", 230, 340, "Арена Ангелов");
                buildset(2222, "zima_cap_stop", 258, 21, "Проход закрыт");
                buildset(10, "arr_right_png", 260, 710, "Замковая площадь");
                echo "</div></td></tr></table>";
            } elseif ($user['room'] == 2111) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_bg_d2';
                    $fon = 'zima_rist_bg_day2';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_bg_n2';
                    $fon = 'zima_rist_bg_night2';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(1,"cap_rist_arr_left",240,30,"Страшилкина Улица");
                buildset(1, "zima_cap_arr_uleft", 240, 30, "Страшилкина Улица");
                //buildset(2,"stop_png",245,708,"Проход закрыт");
                buildset(2, "zima_cap_arr_right", 245, 708, "Секретный Лабиринт");
                //buildset(2,"zima_cap_arr_right",245,708,"Проход закрыт");
                //buildset(4,"av_zaliv_svet",200,260,"Храмовая Лавка");
                //buildset(5,"av_zaliv_tma",175,570,"Храм Древних");
                //buildset(14,"vesna_cap_rist_solo",210,160,"Вход в Одиночные сражения");
                buildset(14, "zima_cap_rist_solo", 210, 160, "Вход в Одиночные сражения");
                //buildset(5,"vesna_cap_rist_group",243,340,"Вход в Сражение отрядов");
                buildset(14, "zima_cap_rist_group", 243, 340, "Вход в Сражение отрядов");
                //buildset(16,"lord_castle",110,310,"Замок Лорда Разрушителя");
                buildset(1000, "av_zamk_rud", 80, 310, "Рудник");
                //buildset(16555,"vesna_cap_rist_monstr",145,570,"Вход в Груповые сражения");
                buildset(203, "zima_cap_rist_monstr", 145, 570, "Вход в Груповые сражения");
                //buildset(21,"angelscastle",131,628,"Замок Мэра Города");

                $laikas = mysql_result(mysql_query("SELECT `bochka` FROM `users` WHERE `id` = '{$user['id']}'; "), 0);
                if (!isset($laikas)) {
                    $laikas = time() - 60 * 60 * 4;
                    mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "' WHERE `id` = '{$user['id']}'; ");
                }
                if ($_SESSION['usebochka'] == '1' && $laikas <= time() - 60 * 60 * 4) {
                    $laikas = time();
                    mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "' WHERE `id` = '{$user['id']}'; ");
                    $_SESSION['usebochka'] = '0';
                    $bon = mt_rand(1, 4);
                    if ($bon == 1) {
                        $kr = mt_rand(1, 25);
                        if ($kr >= 15) {
                            $kr1 = mt_rand(16, 25);
                            if ($kr1 >= 20) {
                                addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесенной бочке Вы нашли ' . $kr1 . ' кр. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                                mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `money`=`money`+$kr1 WHERE `id` = '{$user['id']}'; ");
                            } else {
                                addchp('<spanstyle="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесенной бочке Вы нашли ' . $kr1 . ' кр. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                                mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `money`=`money`+$kr1 WHERE `id` = '{$user['id']}'; ");
                            }
                        } else {
                            addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесенной бочке Вы нашли ' . $kr . ' кр. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                            mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `money`=`money`+$kr WHERE `id` = '{$user['id']}'; ");
                        }
                    } elseif ($bon == 2) {
                        $doblest = mt_rand(1, 75);
                        if ($doblest >= 40) {
                            $doblest1 = mt_rand(41, 75);
                            if ($doblest1 >= 60) {
                                addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесеной бочке Вы нашли ' . $doblest1 . ' оч.репутации. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                                mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `doblest`=`doblest`+$doblest, `reputation`=`reputation`+'$doblest' WHERE `id` = '{$user['id']}'; ");
                            } else {
                                addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесеной бочке Вы нашли ' . $doblest1 . ' оч.репутации. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                                mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `doblest`=`doblest`+$doblest, `reputation`=`reputation`+$doblest WHERE `id` = '{$user['id']}'; ");

                            }
                        } else {
                            addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесеной бочке Вы нашли ' . $doblest . ' оч.репутации. </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                            mysql_query("UPDATE `users` SET `bochka`='" . $laikas . "', `doblest`=`doblest`+$doblest, `reputation`=`reputation`+$doblest WHERE `id` = '{$user['id']}'; ");
                        }
                    } elseif ($bon == 3) {
                        $rom = mt_rand(1, 75);
                        if ($rom >= 40) {
                            $rom1 = mt_rand(41, 75);
                            if ($rom1 >= 60) {
                                addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> В принесеной бочке Вы нашли странный сосуд... </span>   ', '{[]}' . nick7($user['id']) . '{[]}');
                                mysql_query("INSERT INTO `inventory` (`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`magic`,`otdel`, `isrep`)                
                        VALUES  ('5900400','{$_SESSION['uid']}','Бутыль старого пирата','51','1','5','rom.gif',1,'555','188','0') ;");
                            } else {
                                addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> Ничего, кроме не нужных водорослей, Вы не нашли...  ', '{[]}' . nick7($user['id']) . '{[]}');
                            }
                        } else {
                            addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> Ничего, кроме не нужных водорослей, Вы не нашли...  ', '{[]}' . nick7($user['id']) . '{[]}');
                        }
                    } else {
                        addchp('<span style="color:red"><b>Внимание!</b></span> <span style="color:red"> Ничего, кроме не нужных водорослей, Вы не нашли...  ', '{[]}' . nick7($user['id']) . '{[]}');
                    }
                } elseif ($laikas <= time() - 60 * 60 * 4) {
                    buildset(3, "bochka", 270, 630, "Бочка");
                }

                //buildset(21,"angelscastle",131,628,"Замок Мэра Города");
                echo "</div></td></tr></table>";
            } elseif ($user['room'] == 2701) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    $fon = 'av_arena_bg1_day2';
                } else {
                    $fon = 'av_arena_bg1_day2';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                buildset(1, "3strelka", 260, 30, "Берег Залива");
                buildset(2, "shar_dark", 234, 356, "Лабиринт Хаоса");
                buildset(3, "stop_png", 260, 720, "Проход закрыт");
                echo "</div></td></tr></table>";
            } //Торговая улица
            elseif ($user['room'] == 2702) {
                if ((int)date("H") > 5 && (int)date("H") < 22) {
                    //$fon = 'vesna_cap_torg_day';
                    $fon = 'zima_cap_torg_day';
                    $fon2 = 'snow_transp';
                } else {
                    //$fon = 'vesna_cap_torg_night';
                    $fon = 'zima_cap_torg_night';
                    $fon2 = 'snow_transp';
                }
                echo "<table width=1><tr><td><div style=\"position:relative; cursor: pointer;\" id=\"ione\"><img src=\"i/city/", $fon, ".jpg\" alt=\"\" border=\"0\"/>";
                echo "<table width=1><tr><td><div style=\"position:absolute;  left: 0px; top: 0px;\" id=\"ione\"><img src=\"i/city/", $fon2, ".gif\" alt=\"\" border=\"50\"/>";
                //buildset(14,"vesna_cap_build1",175,70,"Арендная лавка");
                buildset(6, "zima_cap_arenda", 175, 70, "Академия");
                //buildset(5,"vesna_cap_fontan",210,350,"Фонтан удачи");
                buildset(202, "zima_cap_fontan", 210, 350, "Фонтан удачи");
                //buildset(16,"t_build42",120,300,"Аукцион");
                buildset(16, "t_build42", 120, 300, "Аукцион");
                //buildset(16555,"vesna_cap_build3",155,480,"Прокатная лавка");
                buildset(16555, "zima_cap_prokat", 155, 480, "Прокатная лавка");
                //buildset(21,"vesna_cap_build2",150,565,"Ломбард");
                buildset(21, "zima_cap_lombard", 150, 565, "Ломбард");
                //buildset(4,"cap_rist_arr_left",259,25,"Центральная площадь");
                buildset(10, "zima_cap_arr_uleft", 259, 25, "Центральная площадь");
                //buildset(3,"stop_png",259,720,"Проход закрыт");
                buildset(3, "zima_cap_stop", 259, 720, "Проход закрыт");
                echo "</div></td></tr></table>";
            }
            ?>

            <?
            //Нападение на Цп после 8
            if ((int)date("H") >= 19 && $user['room'] == 20 || (int)date("H") >= 0 && (int)date("H") < 5 && $user['room'] == 20) {
                $ms_cit = array('Вечер, звёзды... разбойник за каждым углом...',
                    'Говорят, ночью тут вампиры гуляют...',
                    'Темно, страшно, даже паладинов не видно...'
                );
                echo "<span class=cit_note>" . $ms_cit[rand(0, 2)] . "</span>";
                ?>
                <SCRIPT src='js/commoninf.js'></SCRIPT>
                <SCRIPT>
                    var Hint3Name = '';

                    // Заголовок, название скрипта, имя поля с логином
                    function findlogin(title, script, name) {
                        document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
                            '<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="<? echo @$user['id']; ?>"><td colspan=2>' +
                            'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
                        document.all("hint3").style.visibility = "visible";
                        document.all("hint3").style.left = 100;
                        document.all("hint3").style.top = 100;
                        document.all(name).focus();
                        Hint3Name = name;
                    }

                    function closehint3() {
                        document.all("hint3").style.visibility = "hidden";
                        Hint3Name = '';
                    }
                </SCRIPT>

                <div align="right" id="hint3"></div>
                <INPUT TYPE="button" value="Напасть"
                       onclick="findlogin('Введите имя персонажа', 'city.php?nap=attack', 'target'); ">
                <?
//сам скрипт нападения
                if ($_GET['nap'] == "attack" && $user['room'] == 20) {
                    include "magic/cityattack.php";
                }
            }
            ?>


            </div>
        </td>
    </tr>
</table>
<script language="javascript" src="js/refreshonline.js"></script>
</body>
</html>