<?php
define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='O`yinchi';
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");

if($rights>=7)
{
	if($id){$q=mysql_query("select * from fman_players where id=$id;");
	$a=mysql_fetch_array($q);
	$p="id=".$id;}
	if(!$_POST[submit])
	{
		echo"<h2 align='center'>"; if(!$id)echo"Qo`shish"; else echo"O`zgartirish"; echo" o`yinchi</h2><form action='admplayer.php?".$p."' method='post'><div class='menu'>Ismi:<br/><input type='text' name='name' value='$a[name]'/><br/>
		Jamoa ID raqami:<br/><input type='text' name='team_id' value='$a[team_id]' size='6'/><br/>
		Ampluasi:<br/><select name='pos'><option value='1'";
		$a[pos]=$a[ampl]; if($a[pos]==1)echo" selected='selected'"; echo">D</option>
		<option value='2'"; if($a[pos]==2)echo" selected='selected'"; echo">ChH</option>
		<option value='3'"; if($a[pos]==3)echo" selected='selected'"; echo">MH</option>
		<option value='4'"; if($a[pos]==4)echo" selected='selected'"; echo">O`H</option>
		<option value='5'"; if($a[pos]==5)echo" selected='selected'"; echo">TH</option>
		<option value='6'"; if($a[pos]==6)echo" selected='selected'"; echo">ChY</option>
		<option value='7'"; if($a[pos]==7)echo" selected='selected'"; echo">MY</option>
		<option value='8'"; if($a[pos]==8)echo" selected='selected'"; echo">O`Y</option>
		<option value='9'"; if($a[pos]==9)echo" selected='selected'"; echo">HH</option>
		<option value='10'"; if($a[pos]==10)echo" selected='selected'"; echo">H</option></select><br/>
		Talanti (1-20):<br/><input type='text' name='rait' value='$a[rait]' size='6'/><br/>
		Tajriba balli:<br/><input type='text' name='ball' value='$a[ball]' maxlenght='4'/><br/>
		URL rasmi:<br/><input type='text' name='foto' value='$a[foto]'/><br/>
		Yoshi:<br/><input type='text' name='age' value='$a[age]' size='6'/><br/>
		Bo`yi (sm):<br/><input type='text' name='height' value='$a[height]' size='6'/><br/>
		Millati:<br/><input type='text' name='nationality' value='$a[nationality]' size='6'/><br/>"; if($id)echo"<input type='checkbox' name='del' value='1'/> o`yinchini o`chirish<br/>"; echo"<input type='submit' name='submit' value='Saqlash'/></div></form>";
	}
	else
	{
		$team_id=$_POST[team_id]; $name=$_POST[name]; $rait=$_POST[rait]; $opit=$_POST[ball];
		$pos=$_POST[pos];
		if($team_id>=1 && $name && $rait>=1 && $pos>=1){
		if($id)mysql_query("update fman_players set team_id=$team_id, name='$name', ball='$opit', rait=$rait, pos=$pos, ampl=$pos, foto='$_POST[foto]', age='$_POST[age]', height='$_POST[height]', nationality='$_POST[nationality]' where id=$id"); else mysql_query("insert into fman_players set team_id=$team_id, name='$name', rait=$rait, travm=0, trans=0, cena=0, pos=$pos, ampl=$pos, foto='$_POST[foto]', age='$_POST[age]', height='$_POST[height]', nationality='$_POST[nationality]', forma=6, ust=6, nast=6, u=0, vyn=0, drib=0, pas=0, ig=0, otb=0, priem=0, f=0, toch=0, gk=0, ball=0");
		if($_POST[del]==1)mysql_query("delete from fman_players where id=$id;");
		echo"<div class='menu'>Harakat ijobiy bajarildi!<br/><a href='admplayer.php?time=".time()."&amp;".$p."'>Orqaga</a></div>";}
	}
	echo"<div class='phdr'>"; if($id)echo"<a href='admplayer.php?'>Создать нового игрока</a><br/>"; echo"<a href='index.php?'>Futbol menejer</a></div>";
} 
require_once("../incfiles/end.php"); ?>