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

if($user_id && !$club_id)
{
	switch($act)
	{
		default:
		$q=mysql_query("select * from fman_clubs where user_id<1 and id!=99 ORDER BY id;");

		echo"<div class='phdr'>O`zingiz menejeri bo`lishni hohlagan jamoani tanlang</div>";
		if(!mysql_num_rows($q))echo"<div class='menu'>Bo`sh joylar yo`q</div>"; 
		else
		{
			echo"<div class='menu'>";
			while($a=mysql_fetch_array($q))echo"<div><img src='/man/emblems/$a[id].jpg' style='width: 16px; height: 16px;'> <a href='zayv.php?act=pod&amp;id=$a[id]'>$a[name]</a></div>";
			echo"</div>";
		}
		break;
		case 'pod':
		$q=mysql_query("select * from fman_clubs where id='$id';");
		$a=mysql_fetch_array($q);
		if($a[user_id]<1)
		{
			if(!isset($_GET[yes]))
			{
				echo"<div class='menu'>Siz <b>$a[name]</b> jamoasining menejeri bo`lishni rostdan ham hohlaysizmi ?<br/>
				<a href='zayv.php?act=pod&amp;id=$id&amp;yes=yes'>Ha</a> | <a href='zayv.php'>Yo`q</a></div>";
			}
			else
			{
				if($rights>=1)$u9=1; else $u9=1;
				mysql_query("update users set manager2='$id' where id='$user_id'");
				mysql_query("update fman_clubs set user_id='$user_id', u8='".time()."', u9='$u9' where id='$id'");
				$wtext='<a href="club.php?id='.$id.'">'.$a[name].'</a> ning yangi menjeri <a href="/users/profile.php?user='.$user_id.'">'.$login.'</a> bo`ldi.';
				mysql_query("insert into fman_news set time=$realtime, pl_id=0, club_id=0, text='$wtext'");
				$wtext='Klubning yangi bosh murabbiyi etib <a href="/users/profile.php?user='.$user_id.'">'.$login.'</a> tayinlandi';
				mysql_query("insert into fman_news set time=$realtime, pl_id=0, club_id=$id, text='$wtext'");
				echo"<div class='menu'>Tabriklaymiz! Siz <b>$a[name]</b> ning menejeri bo`ldingiz !<br/>

				";
				echo"<a href='index.php'>O`ynash!</a></div>";
			}
		}
		break;
	}
	echo"<div class='phdr'><a href='index.php'>Futbol Menejer</a></div>";
}
if(!$user_id)echo"<div class='menu'>Klub olish uchun avval ro`yhatdan o`ting yoki saytga o`z nomingiz bilan kiring.</div>";
require_once("../incfiles/end.php"); 
?>