<?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';

if(isset($_GET['id']))
{
	$id = abs(intval($_GET['id']));
	
	$res = mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_i` WHERE `id`='".$id."' AND `id_u`='".$user_id."'"),0);

}		
echo '<div class="'.$diz['post_1'].'"><img src="i/city_large.png" /> <b style="font-size:1.3em;">Ремонт вещей</b><b style="font-size:1.3em;float:right;">'.date("H:i",time()).'</b></div>
<div class="'.$diz['post_1'].'">';
if($res==0)echo 'Такой вещи нет!';
else
{
	$arr = mysql_fetch_array(mysql_query("SELECT * FROM `sims_i` WHERE `id`='".$id."'"));
	if(isset($_GET['repair']) && $sims_user['money']>(10*$arr['iznos']))
	{
	mysql_query("UPDATE `sims_i` SET `iznos`='0' WHERE `id`='".$id."'");
	mysql_query("UPDATE `sims_user` SET `money`=`money`-".(10*$arr['iznos'])." WHERE `id_u`='".$user_id."'");
	header("Location:house.php");
	exit;
	}
	echo 'Ремонт '.$arr['name'].'<br/>
	Износ : '.$arr['iznos'].'%<br/>
	Стоимость : '.(10*$arr['iznos']).'$ (у вас '.$sims_user['money'].'$)
	<br/>
	<a href="repair.php?id='.$id.'&amp;repair"><b>Ремонт</b></a>';

}
echo '</div>';
sims_ret($diz['ret'],'Дом','house.php');
sims_ret($diz['ret'],'Назад','index.php');
include_once '../sys/inc/tfoot.php';
?>
