<?php
define('_IN_JOHNCMS', 1);
$headmod = 'manager';
$textl='Admin panel';
require_once("../incfiles/core.php");
require_once("../incfiles/head.php");
require_once("manfunc.php"); 

if($rights>=7)
{
	switch($act)
	{
		default:
		
		echo"<div class='phdr'>Menejer boshqaruvi</div>";
		if ($rights==9) echo"
		<div class='menu'><a href='adminka.php?act=table'>Kalendarni yangilash</a></div>";
		echo"<div class='menu'>
			<div class='menu'><a href='uch.php?act=adm'>Klublar ro'yxati(oxirgi kirishsanasi bilan)</a></div>
		<div class='menu'><a href='addbuild.php'>Qurilish qo'shish</a></div>
		<div class='menu'><a href='addspons.php'>Homiy qo'shish</a></div>
		<div class='menu'><a href='addmatches.php'>O'yinlar qo'shish</a></div>
		<div class='menu'><a href='/medal/add.php'>Sovrinlar qo'shish</a></div>";
		if ($user_id=1) {		
		echo "<div class='menu'><a href='admplayer.php'>O'yinchi yaratish</a></div>";}
		echo"<div class='menu'><a href='admin.php'>Transferlar (yopish)</a></div>";	
	
		//	
		break;
		
		case 'pod':
		
		if(!$id)
		{
			$q=mysql_query("select * from fman_clubs where user_id>0 and u9<1;");
			echo"<div class='phdr'>Qatnashishga so'rovni tasdiqlash</div>";
			while($a=mysql_fetch_array($q)){
			$qu=mysql_query("select * from users where id=$a[user_id];");
			$udata=mysql_fetch_array($qu);
			echo"<div class='menu'><a href='/users/profile.php?user=$udata[id]'>$udata[name]</a> | <a href='club.php?id=$a[id]'>$a[name]</a><br/>
			[<a href='adminka.php?act=pod&amp;do=prin&amp;id=$a[id]'>qabullash</a>][<a href='adminka.php?act=pod&amp;do=otkl&amp;id=$a[id]'>bekor qilish</a>]</div>";}
		}
		else
		{
			$q=mysql_query("select * from fman_clubs where id=$id;");
			$a=mysql_fetch_array($q);
			if($do=="prin"){$uid=$a[user_id]; $u9=1;}
			if($do=="otkl"){$uid=0; $u9=0;}
			mysql_query("update fman_clubs set user_id=$uid, u9=$u9 where id=$id");
			echo"<p>Harakat ijobiy bajarildi!</p>";
		}
		
		break;

		case 'table':
		
		echo"<div class='phdr'>Kalendarni yangilash</div>";
		if(!$_POST['submit'])
		{
			echo"<form action='adminka.php?act=table' method='post'><div class='menu'>Chempionatlarni boshlanish sanasini kiriting (1-tur o'tkaziladigan kun):<br/>
			<input type='text' name='d' value='".date("d")."' size='2'/><input type='text' name='m' value='".date("m")."' size='2'/><input type='text' name='y' value='".date("Y")."' size='4'/><br/>
			<input type='submit' name='submit' value='Tuzish!'/></div></form>";
		}
		else
		{
			$t=mktime(17,0,0,$_POST[m],$_POST[d],$_POST[y]);
			$tn=$t-3600*1*24;
			$file=file("kalendar/calendar.dat");
			mysql_query("delete from fman_matches where turn!='tm' or (turn='tm' and time<".time().");");
			for($i=0;$i<count($file);$i++){
			$a=explode('|',$file[$i]);
			$tm=$tn+3600*24*2*$a[1];
			mysql_query("insert into fman_matches set time=$tm, turn='champ', tur=$a[1], end=0, kom1='$a[2]', id1=$a[3], kom2='$a[4]', id2=$a[5], sc1=0, sc2=0, land='$a[0]'");}
			echo"<p>Yangi mavsum kalendari tuzildi</p>";
		}
		
		break;
	}
	echo"<div class='phdr'><a href='index.php'>Menejerga</a></div>";
} 
require_once("../incfiles/end.php"); ?>