<?php
#########################################
# Скрипт онлайн игры "Симс"_____________#
# Автор: -=FеST=-_______________________#
# ICQ : 345-22-23 ______________________#
# Все права принадлежат автору(-=FeST=-)#
#########################################
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';
$set['title']='The Sims';
include_once '../sys/inc/thead.php';
title();
err();
aut();

if(!isset($user)){
echo 'Вы неавторизованы';
include_once '../sys/inc/tfoot.php';
exit;
}

include_once 'inc/start.php';
include_once 'inc/Sims.class.php';


if(mysql_result(mysql_query("SELECT `city_id` FROM `sims_user` WHERE `id_u`='".$user_id."'"),0)==0)
{
$id = abs(intval($_GET['id']));

$c = mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_city` WHERE `id`='".$id."'"),0);
	
	if($c == 0)
	echo 'Ошибка! Такого города нет';
	else
	{
	
	$city = mysql_query("SELECT * FROM `sims_city` WHERE `id`='".$id."'");
	$arr = mysql_fetch_array($city);
	if(isset($_GET['in']))
	{	
		
		mysql_query("UPDATE `sims_user` SET `city_id`='".$arr['id']."' WHERE `id_u`='".$user_id."'");
		mysql_query("UPDATE `sims_city` SET `ex_house`=`ex_house`+1 WHERE `id`='".$id."'");
	header("Location:house.php");
	exit;
	}
	echo "<div class='".$diz['post_1']."'><img src='i/".$arr['image']."' /><br/><b>".$arr['name']."</b><br/>
	Занято домов : ".$arr['ex_house']."
	<br/>
	".$arr['description']."
	<br/>
	&raquo; <a href='city_in.php?id=".$id."&amp;in'>Поселиться</a>
	</div>";
	
	}


}
else
echo "Ошибка!";


sims_ret($diz['ret'],'Назад','index.php');
include_once '../sys/inc/tfoot.php';
?>
