<?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/user.php';
$set['title']='FM игрок';
include_once '../../sys/inc/thead.php';
title();
err();
aut();

include_once 'online.php';

if (!isset($user) && !isset($_GET['id'])){header("Location: index.php?".SID);exit;}
if (isset($_GET['id']))$id=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_gamers` WHERE `id` = '$id' LIMIT 1"),0)==0){header("Location: index.php?".SID);exit;}


$gamer=mysql_fetch_array(mysql_query("SELECT * FROM `fm_gamers` WHERE `id` = '$id' LIMIT 1"));
$klubi=mysql_fetch_array(mysql_query("SELECT * FROM `fm_club` WHERE `id` = '$gamer[id_club]' LIMIT 1"));
$coach=mysql_fetch_array(mysql_query("SELECT * FROM `fm_coach` WHERE `id_club` = '$klubi[id]' LIMIT 1"));
$ank=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$klubi[id_user]' LIMIT 1"));

if (isset($_GET['del']) && $user['id']==$ank['id'])
{
echo "<div class='menu'>\n";
echo "Удалить игрокa?\n";
echo "[<a href='gamers.php?del=$gamer[id]'>Да</a>][<a href='gamer.php?id=$gamer[id]'>Нет</a>]<br />\n";
echo "</div>\n";
}

echo "<div class='frends2'>";
echo "Владелец: <a href='/info.php?id=$ank[id]'>$ank[nick]</a><br />";
echo "Имя: <b>$gamer[name]</b>\n";
if ($user['id']==$ank['id'])echo "[<a href='gamer.php?id=$gamer[id]&amp;del'><b><span style='color:#FF0000'>x</span></b></a>]\n";
echo "<br />Тренер:\n";
$coach2=mysql_result(mysql_query("SELECT COUNT(*) FROM `fm_coach` WHERE `id_club` = '$klubi[id]'"),0);
if ($coach2==1){echo "<a href='coach.php?id=$klubi[id_user]'>$coach[name]</a><br />";}
else 
{
if ($user['id']==$ank['id']){echo "<a href='coach.php'>Купить</a><br />";}else{echo "У него нет!<br />";}
}

if($gamer['poz']==0){
$statusi='голкипер';
}else if($gamer['poz']==1){
$statusi='защитник';
}else if($gamer['poz']==2){
$statusi='полузащитник';
}else if($gamer['poz']==3){
$statusi='нападающий';}
echo "Позиция: $statusi<br />";
echo "Уровень: $gamer[level]<br />";
echo "Играет с: ".vremja($gamer["time"])."<br />";
echo "</div>";
echo "<div class='foot'>";
echo "&#171; <a href='index.php'>Назад</a><br/>";
echo "</div>";

include_once '../../sys/inc/tfoot.php';

?>
