Просмотр файла include/life_time.php

Размер файла: 3.23Kb
<?php 
Error_Reporting(E_ALL & ~E_NOTICE);
$base_H                = 1; //часы
$base_i                =  0; //Не менять
$base_s                = 0;   //Не менять
$base_day                = 1;                //   дни
$base_mon                = 1;                //   месяцы
$base_yr                = 2007;                //  год
$current_H                = date("H",time());
$current_i                = date("i", time());
$current_s                = date("s", time());   
$current_day                = date ("j");
$current_mon                = date ("n");
$current_yr                = date ("Y");
$base_mon_max                = date ("t",mktime (0,0,0,$base_mon,$base_day,$base_yr));
$base_day_diff                 = $base_mon_max - $base_day;
$base_H_diff                 = "24" - $base_H;
$base_i_diff                 = "60" - $base_i;
$base_s_diff                 = "60" - $base_s;
$base_mon_diff                 = 12 - $base_mon - 1;
$start_H                = 1;
$start_i                = 1;
$start_s                = 1;
$start_day                = 1;
$start_mon                = 1;
$start_yr                = $base_yr + 1;
$H_diff               = ($current_H - $start_H) + 1;
$i_diff            = ($current_i - $start_i) + 1;
$s_diff              = ($current_s - $start_s) + 1;
$day_diff        = ($current_day - $start_day) + 1;
$mon_diff        = ($current_mon - $start_mon) + 1;
$yr_diff        = ($current_yr - $start_yr);
$day_diff        = $day_diff + $base_day_diff;
$mon_diff        = $mon_diff + $base_mon_diff;
if ($day_diff >= $base_day_max)
{
$H_diff = $H_diff - $base_H ;
$day_diff = $day_diff + 1;
}
if ($i_diff >= $base_i_max)
{
$i_diff = $i_diff - $base_i ;
$H_diff = $H_diff + 1;
}
if ($day_diff >= $base_mon_max)
{
$day_diff = $day_diff - $base_mon_max;
$mon_diff = $mon_diff + 1;
}
if ($mon_diff >= 12)
{
$mon_diff = $mon_diff - 12;
$yr_diff = $yr_diff + 1;
}
print "<br/>
Сайт существует:";
$years = "года"; 
$days = "дня"; 
  $mon  = "месяца";
   $H  = "часа";
    $s  = "сек.";
	 $i  = "мин.";
	$w2=array(
'21','22','23','24',
'31','32','33','34',
'41','42','43','44',
'51','52','53','54'
	); 
if ($yr_diff == "1") $years = "год"; 
if ($day_diff == "1") $days = "день"; 
if ($yr_diff > "4") $years = "лет"; 
if ($day_diff > "4") $days = "дней"; 
if ($mon_diff == "1") $mon = "месяц";
if ($day_diff == "21") $days = "день";
if ($day_diff == "22") $days = "дня";
if ($day_diff == "23") $days = "дня";
if ($day_diff == "24") $days = "дня";
if ($mon_diff > "4") $mon = "месяцев";
if ($H_diff > "4") $H = "часов";
if ($H_diff == "21") $H = "час";
if ($H_diff == "22") $H = "часа";
if ($H_diff == "23") $H = "часа";
if ($H_diff == "24") $H = "часа";
if ($H_diff == "1") $H = "час";
$H=str_replace("0","24",$H);
if ($yr_diff > "0") {print $yr_diff." ".$years.", ";} else {echo"";}
if ($mon_diff > "0") {print $mon_diff." ".$mon."  ";} else {echo"";}
if ($day_diff > "0"){print $day_diff." ".$days; }else {echo"ровно";}
print "<br />";
if ($H_diff > "0"){print $H_diff ." ".$H; }else {echo"";}
print " ".$i_diff." ".$i."";
print " ".$s_diff." ".$s."<br/>
";
?>