<?
define('_IN_JOHNCMS', 1);
$textl='Umr hisoblagich';
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
if(!isset ($_POST['day']) or !isset ($_POST['month']) or !isset ($_POST['year']))
{
	echo "<div class='phdr'><b>Umr hisoblagichi</b></div>";
	echo '<div class="menu">Tug`ilgan sanangizni kiriting</div><div class="menu">';
	echo '<form action="umr.php" method="post"><select name="day" value="day">';
	for($i = 1; $i <= 31; $i++)
	{
		if($i < 10)
		{
			echo '<option value="0'.$i.'">0'.$i.'</option>';
		}
		else
		{
			echo '<option value="'.$i.'">'.$i.'</option>';
		}
	}
	echo '</select>&nbsp;<select name="month" value="month">
<option value="01">Yanvar</option>
<option value="02">Fevral</option>
<option value="03">Mart</option>
<option value="04">Aprel</option>
<option value="05">May</option>
<option value="06">Iyun</option>
<option value="07">Iyul</option>
<option value="08">Avgust</option>
<option value="09">Sentabr</option>
<option value="10">Oktabr</option>
<option value="11">Noyabr</option>
<option value="12">Dekabr</option>
</select>&nbsp;<select name="year" value="year">';
	for($i = date('Y') - 100; $i <= date('Y'); $i++)
	{
		echo '<option value="'.$i.'">'.$i.'</option>';
	}
	echo '</select></div><div class="menu"><input type = "submit" name = "submit" value = "Hisoblash"/></form></div>';
}
else
{
	$day = abs(intval($_POST['day']));
	if($day < 1 or $day > 31)
	{
		$day = 01;
	}
	elseif ($day < 10)
	{
		$day = '0'.$day;
	}
	$month = ''.abs(intval($_POST['month']));
	if($month < 1 or $month > 12)
	{
		$month = 01;
	}
	elseif ($month < 10)
	{
		$month = '0'.$month;
	}
	$year = abs(intval($_POST['year']));
	echo "<div class='phdr'><b>Umr hisoblagichi</b></div><div class='menu'>Tug`ilgan vaqtingiz: <b>".$day.".".$month.".".$year."</b></div>";
	$tim = mktime(date("G"), date("i"), 0, $month, $day, $year);
	$atim = time() - $tim;
	$y = (intval($atim / 31556926));
	echo "<div class='menu'><b>Siz yashagansiz:</b><br/><b>";
	echo $y."</b> yil<br/><b>";
	echo intval($atim / 2629743)."</b> oy<br/> <b>";
	echo intval($atim / 604800)."</b> hafta<br/><b>";
	echo intval($atim / 86400)."</b> kun<br/><b>";
	echo intval($atim / 3600)."</b> soat<br/><b>";
	echo intval($atim / 60)."</b> daqiqa<br/>";
	echo "<b>".$atim."</b> soniya<br/>";
	if($month.$day == date("nj"))
		echo "<font color='red'>Tug`ilgan kuningiz bilan!!!</font><br/>";
	else
	{
		if($month.$day > date("nj"))
		{
			$aatim = intval((mktime($hour, $min, 0, $month, $day, date("Y")) - time()) / 86400);
			echo "Tug`ilgan kuningiz ".$aatim." kundan keyin<br/>";
		}
		else
		{
			$aatim = intval((mktime($hour, $min, 0, $month, $day, date("Y") + 1) - time()) / 86400);
			echo "Bu yilgi tug`ilgan kuningiz o`tib ketgan<br/>Kelasi yilgisi ".$aatim." kundan keyin<br/>";
		}
		echo "Yoshingiz: ".($y + 1)." yil<br/>";
	}
	echo "Burjingiz: ";
	switch(intval($month))
	{

		case 1 :
			echo $day <= 20 ? 'Tog` echkisi' : 'Qovg`a';
			break;

		case 2 :
			echo $day <= 19 ? 'Qovg`a' : 'Baliq';
			break;

		case 3 :
			echo $day <= 21 ? 'Baliq' : 'Qo`y';
			break;

		case 4 :
			echo $day <= 21 ? 'Qo`y' : 'Buzoq';
			break;

		case 5 :
			echo $day <= 21 ? 'Buzoq' : 'Egizaklar';
			break;

		case 6 :
			echo $day <= 22 ? 'Egizaklar' : 'Qisqichbaqa';
			break;

		case 7 :
			echo $day <= 23 ? 'Qisqichbaqa' : 'Arslon';
			break;

		case 8 :
			echo $day <= 23 ? 'Arslon' : 'Parizod';
			break;

		case 9 :
			echo $day <= 23 ? 'Parizod' : 'Tarozi';
			break;

		case 10 :
			echo $day <= 23 ? 'Tarozi' : 'Chayon';
			break;

		case 11 :
			echo $day <= 22 ? 'Chayon' : 'O`qotar';
			break;

		case 12 :
			echo $day <= 22 ? 'O`qoatar' : 'Tog` echkisi';
			break;
	}
	echo '</div>';
}
require_once ("../incfiles/end.php");
?>