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

$id = abs(intval($_GET['id']));		

	$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_user` WHERE `id_u`='".$id."'"),0);
	if($count == 0)
	$ank = $sims_user;
	else
	$ank = mysql_fetch_array(mysql_query("SELECT * FROM `sims_user` WHERE `id_u`='".$id."'"));

	if(isset($_POST['submit']))
	{
	$msg = sims_in($_POST['text']);
	$msg = mb_substr($msg,0,512,'UTF-8');
	if($msg =='')$msg = 'Пустое сообщение';
	mysql_query("INSERT INTO `sims_wall`(`id_u`,`id_ank`,`time`,`msg`) VALUES('".$ank['id_u']."','".$user_id."','".time()."','".$msg."')");
	header("Location:profile.php?id=".$ank['id_u']."");
	exit;
	}

		$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `sims_wall` WHERE `id_u`='".$ank['id_u']."'"),0);

echo '<div class="'.$diz['post_1'].'">'.($ank['pol']=='Муж' ? '<img src="i/city_man.png" />' : '<img src="i/city_woman.png" />' ).' <b style="font-size:1.3em;"> '.$ank['name'].' [id '.$ank['id_u'].']</b><b style="font-size:1.3em;float:right;">'.date("H:i",time()).'</b></div>
<div class="'.$diz['post_1'].'">
<img src="i/face_'.$ank['face'].'.png" />
<br/>
Имя : <b>'.$ank['name'].'</b><br/>
Фамилия : <b>'.$ank['fam'].'</b><br/>
Логин : <b>'.mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='".$ank['id_u']."' "),0).'</b><br/>
Статус : <b>'.($ank['last_visit']>(time()-60*3) ? 'Онлайн' : 'Оффлайн').'</b><br/>
Время в игре : <b>'.sims_timer($ank['in_game']).'</b><br/>
Цель жизни : <b>'.$ank['cel'].'</b><br/>
Знак зодиака : <b>'.$ank['zod'].'</b>
'.($ank['ybor_time']>time() ? "<br/><img src='i/cleaner.png' /> У пользователя нанята уборщица" : NULL).'
'.($ank['gor_time']>time() ? "<br/><img src='i/c_woman.png' /> У пользователя нанята горничная" : NULL).'
'.($ank['dvor_time']>time() ? "<br/><img src='i/c_man.png' /> У пользователя нанят дворецкий" : NULL).'
</div>
<div class="'.$diz['post_2'].'">
<img src="i/skills.png" /> <a href="skills.php?id='.$ank['id_u'].'">Навыки</a><br/>
<img src="i/gift.png" /> <a href="gifts.php?id='.$ank['id_u'].'">Подарки</a><br/>

</div>
<div class="'.$diz['post_1'].'">Зайти в гости <br/>
<img src="i/room_1.png" /> <a href="room.php?id_user='.$ank['id_u'].'&amp;room=1"><b>Гостиная</b></a><br/>
<img src="i/room_2.png" /> <a href="room.php?id_user='.$ank['id_u'].'&amp;room=2"><b>Санузел</b></a><br/>
<img src="i/room_3.png" /> <a href="room.php?id_user='.$ank['id_u'].'&amp;room=3"><b>Кухня</b></a><br/>
<img src="i/room_4.png" /> <a href="room.php?id_user='.$ank['id_u'].'&amp;room=4"><b>Спальня</b></a>
</div>
<div class="'.$diz['post_2'].'"><b>Стена</b> '.$total.' записей
<br/>
<form method="post" action="profile.php?id='.$ank['id_u'].'&amp;'.rand(1,50000).'">
<textarea name="text" ></textarea><br/>
<input type="submit" name="submit" value="Отправить" />
</form></div>';

		if($total == 0)
		echo 'Нет записей';
		else
		{
			$quert=mysql_query("SELECT * FROM `sims_wall` WHERE `id_u`='".$ank['id_u']."' ORDER BY `id` DESC LIMIT ".$start.",5");
			
			while($array=mysql_fetch_array($quert)){
				
			
				
				echo '<div class="'.$diz['post_1'].'">
				<table cellpadding="0">
				<tr>
				<td>
				<img width="30" src="i/face_'.mysql_result(mysql_query("SELECT `face` FROM `sims_user` WHERE `id_u`='".$array['id_ank']."'"),0).'.png" alt="." /> 
				</td>
				<td>

				 <a href="profile.php?id='.$array['id_ank'].'"><b>'.mysql_result(mysql_query("SELECT `name` FROM `sims_user` WHERE `id_u`='".$array['id_ank']."'"),0).' '.mysql_result(mysql_query("SELECT `fam` FROM `sims_user` WHERE `id_u`='".$array['id_ank']."'"),0).'</b></a>
				<br/>
				'.sims_in($array['msg']).'
				<br/>
				'.sims_date($array['time']).'
				</td></tr></table></div>';
			}
		
		
		if ($total > 5)
		echo sims_pagenav('profile.php?id='.$ank['id_u'].'&amp;', $start, $total, 5);
		}

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