<?php




define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='O`yinchilar ro`yxati'; require_once("../incfiles/core.php");
require_once("manfunc.php"); require_once("../incfiles/head.php");
if($club_id && !$id)$id=$club_id;
$qt=mysql_query("select * from fman_clubs where id=$id;");
$tdata=mysql_fetch_array($qt);
$pid=$_GET[pid];
if($pid){$qp=mysql_query("select * from fman_players where id=$pid;");
$pdata=mysql_fetch_array($qp);}
switch($act){
default:
$q=mysql_query("select * from fman_players where team_id=$id order by ampl;");
echo"<div class='phdr'><img src='/man/emblems/$tdata[id].jpg' width='24' height='24'> $tdata[name]</div>";
echo'<table class="table" width="100%" border="0" cellspacing="1" cellpadding="4">
	 <tr class="un_table">
	 <td align="center"><b>Poz.</b></td>
	 <td align="center"><b>O\'yinchi</b></td>
	 <td align="center"><b>Iqtidori</b></td>
	 <td align="center"><b>Gol</b></td></tr>';
	 $i=1;
		while($a=mysql_fetch_array($q)){
echo $i % 2 ? '<tr class="list1">' : '<tr class="list2">';
echo' <td align="center">'; echo strtr($a[ampl],array(10=>'Н',1=>'D',2=>'ChH',3=>'MH',4=>'O`H',5=>'TY',6=>'CHY',7=>'MY',8=>'O`Y',9=>'HH')); echo'</td>
      <td><a href="player.php?id='.$a['id'].'">'.$a['name'].'</a></td>
	  <td align="center">'.$a['rait'].'</td>
	  <td align="center">'.$a['goals'].'</td></tr>';
	  ++$i;
}
if(mysql_num_rows($q))echo"</table><div class='bmenu'>Barcha o`yinchilar: <b>".mysql_num_rows($q)."</b></div>"; else echo"<div class='menu'>Jamoa tarkibi ro`yhatdan o`tilgandan so`ng 1-2 kun davomida yangilandi.</div>";
break;
case 'uvol':
if($pdata[trans])$e="Xato! Agar o`yinchi transferga qo`yilgan bo`lsa uni bo`shatish taqiqlanadi.";

if(count_players($id)<16)$e="Xato! Agar jamoada o`yinchilar 16 kishidan kam bo`lsa ularni bo`shatish taqiqlanadi!";
if($e)echo"<div class='rmenu'>$e</div>";
if($club_id==$id && $pid && !$e){
if($dataclub[uvol_count]<1){
echo"<h2 align='center'>O`yinchini bo`shatish</h2>";
if(!$_GET[yes]){
echo"<div class='menu'>Siz <b>$pdata[name]</b> ni bo`shatishga aminmisiz ? Bu qaror so`nggi qaror bo`ladi va uni qaytarish mumkin emas. Bo`shatish nafaqasi - $500 000<br/>
<a href='list-of-players.php?id=$id&amp;pid=$pid&amp;act=uvol&amp;yes=yes'>Bo`shatish</a> | <a href='list-of-players.php?id=$id'>Bekor qilish</a></div>";}else{
mysql_query("update `fman_players` set `team_id`='0', `trans`='1', `cena`='0', `zarplat`='0', `trans_time`='".(($realtime+259200)-date("s"))."' where `id`='$pid'");
$bu=$dataclub[budj]-500000;
$j1=$dataclub[uvol_count]+1;
mysql_query("update fman_clubs set budj=$bu, uvol_count=$j1 where id=$club_id");
zamena($tdata,$pdata);
mysql_query("insert into fman_news set time=$realtime, pl_id=$pdata[id], name='$pdata[name]', id1=$club_id, club_id=0");
$wtext='<a href="player.php?id='.$pid.'">'.$pdata[name].'</a> jamoa rahbariyati tomonidan bo`shatildi. Bo`shatish nafaqasi $500 000.';
mysql_query("insert into fman_news set time=$realtime, pl_id=0, club_id=$id, text='$wtext'");
echo"<div class='menu'>Siz <b>$pdata[name]</b> ni bo`shatdingiz va kompensatsiya tariqasida $500 000 to`ladingiz</div>";}}else{
echo"<div class='menu'>Bir virtual xaftada 1 tadan ortiq o`yinchini bo`shatish mumkin emas!</div>";}}
break;
case 'trans':
 $gconf=mysql_fetch_array(mysql_query("SELECT * FROM `manager`"));
if($gconf[0]['open']!=1){
if($club_id==$id && $pid){
if($dataclub[trans_count]<2){
if(!isset($_POST[submit])){
echo"<div class='menu'><form action='list-of-players.php?id=$id&amp;pid=$pid&amp;act=trans' method='post'>

O`yinchi <b>$pdata[name]</b> ni transferga qo`yamiz<br/>

Narxi: <input type='text' name='cena' value='0' size='6'/><br/>
<input type='submit' name='submit' value='OK'/></form></div>";}else{

if(!is_numeric($_POST[cena]) || $_POST[cena]<1)$_POST[cena]=0;
mysql_query("update `fman_players` set `trans`='1', `cena`='$_POST[cena]', `zarplat`='0', `trans_time`='".(($realtime+259200)-date("s"))."' where `id`='$pid'");
$j1=$dataclub[trans_count]+1;
mysql_query("update fman_clubs set trans_count=$j1 where id=$club_id");
echo"<div class='menu'>O`yinchi <b>$pdata[name]</b> ni transferga qo`yildi!</div>";}}else echo"<div class='menu'>Bir virtual xaftada 2 tadan ortiq o`yinchini transferga qo`yish mumkin emas!</div>";}
}else{echo '<div class="msg">Тransfer Adminstratsiya tomonidan berkitilgan!</div>';};
break;

case 'atrans':
if($club_id==$id){
mysql_query("update `fman_players` set `trans`='0', `cena`='0' where `id`='$pid'");
echo"<div class='menu'>O`yinchi <b>$pdata[name]</b> transferdan olindi!</div>";
} break;}

if($pid)echo"<div class='phdr'><a href='list-of-players.php?id=$id'>O`yinchilar ro`yhatiga</a></div>";
echo"<div class='phdr'><a href='club.php?id=$id'>$tdata[name]</a><br/>
<a href='index.php'>Futbol Menejer</a></div>";
require_once("../incfiles/end.php"); ?>