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

echo"<h2 align='center'>$textl</h2>";
if($rights>=7)
{
	if(!$_POST['submit'])
	{
		echo"<form action='addmatches.php?' method='post'><div class='menu'>Turnir (champ - milliy birinchilik; cup - milliy kubok; supercup - milliy superkubok; lc - ЛЧ; le - ЛЕ; sc - Yevropa superkubogi; tm - o`rtoqlik o`yini):<br/>
		<input type='text' name='turn'/><br/>
		Mamlakatning ikki belgili kodi yoki chempionlar ligasi yoki yevropa ligasidagi guruhi (Masalan. ru yoki b. Chempionlar ligasi/Yevropa ligasi play-off o`yinlari uchun va Yevropa super kubogi uchun - eu):<br/>
		<input type='text' name='land'/><br/>
		Tur (kuboklarda 1 raund - 1; 1/8 - 18; 1/4 - 14; final - 11; Chl/YeL da 1/8 dastlabki o`yinlar - 181; javob o`yinlari - 182 va hakazo.):<br/><input type='text' name='tur' value='0'/><br/>
		Boshlanish vati:<br/><input type='text' name='d' size='2'/><input type='text' name='m' value='".date("m")."' size='2'/><input type='text' name='y' value='".date("Y")."' size='4'/><br/>Vaqti:<br/><input type='text' name='h' size='2'/>:<input type='text' name='i' size='2'/></div>";
		for($i=1;$i<17;$i++)echo"<div class='menu'><input type='text' name='h_$i'/> - <input type='text' name='g_$i'/></div>";

		echo"<div class='menu'><input type='submit' name='submit' value='OK'/></div></form>";
	}
	else
	{
	$t=mktime($_POST[h],$_POST[i],0,$_POST[m],$_POST[d],$_POST[y]);
for($i=1;$i<11;$i++){
$h="h_$i"; $g="g_$i"; $h=$_POST[$h]; $g=$_POST[$g];
if($h && $g){
$q1=mysql_query("select * from fman_clubs where name='$h';");
$a1=mysql_fetch_array($q1);
$q2=mysql_query("select * from fman_clubs where name='$g';");
$a2=mysql_fetch_array($q2);
if($a1[id] && $a2[id])mysql_query("insert into fman_matches set time=$t, turn='$_POST[turn]', tur=$_POST[tur], end=0, kom1='$h', id1=$a1[id], kom2='$g', id2=$a2[id], sc1=0, sc2=0, land='$_POST[land]'");}}
echo"<p>Hamma oyinlar tashkil qilindi! <a href='addmatches.php?mytime=$realtime'>Yana qo`shilsinmi</a></p>";

}
} require_once("../incfiles/end.php"); ?>