Файл: sys/inc/new_year.php
Строк: 72
<?
///By Trec80
///SocMi.Ru
echo "<div class='upban'>";
echo "<center>n";
echo 'До нового года осталось:<br />';
$timediff = 1325365200-$time;
$oneMinute=60;
$oneHour=60*60;
$oneDay=60*60*24;
$dayfield=floor($timediff/$oneDay);
$hourfield=floor(($timediff-$dayfield*$oneDay)/$oneHour);
$minutefield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour)/$oneMinute);
$secondfield=floor(($timediff-$dayfield*$oneDay-$hourfield*$oneHour-$minutefield*$oneMinute));
$sDaysLeft=$dayfield;
$sDaysText = "дней,";
$nDaysLeftLength =strlen($sDaysLeft);
$d_1=substr($sDaysLeft,-1,1);
if (substr($sDaysLeft,-2,1) != 1 && $nDaysLeftLength>1)
{if ($d_1 == 2 || $d_1== 3 || $d_1== 4)
{ $sDaysText = "дней,"; }
elseif ($d_1== 1)
{ $sDaysText = "дней,"; } }
if ($nDaysLeftLength==1)
{ if ($d_1==2 || $d_1== 3 || $d_1== 4)
{ $sDaysText = "дней,"; }
elseif ($d_1== 1)
{ $sDaysText = "дней,"; } }
$nHoursLeftLength = strlen($sHoursLeft);
$h_1=substr($sHoursLeft,-1,1);
if (substr($sHoursLeft,-2,1) != 1 && $nHoursLeftLength>1)
{ if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{ $sHoursText = "час(ов),"; }
elseif ($h_1== 1)
{ $sHoursText = "час(ов),"; } }
if ($nHoursLeftLength==1)
{ if ($h_1== 2 || $h_1== 3 || $h_1== 4)
{ $sHoursText = "час(ов),"; }
elseif ($h_1== 1)
{ $sHoursText = "час(ов),"; } }
$sMinsLeft =$minutefield;
$sMinsText = "минут(а),";
$nMinsLeftLength = strlen($sMinsLeft);
$m_1=substr($sMinsLeft,-1,1);
if ($nMinsLeftLength>1 && substr($sMinsLeft,-2,1) != 1)
{ if ($m_1== 2 || $m_1== 3 || $m_1== 4)
{ $sMinsText = "минут(а),"; }
else if ($m_1== 1)
{ $sMinsText = "минут(а),"; } }
if ($nMinsLeftLength==1)
{ if ($m_1== 2 || $m_1==3 || $m_1== 4)
{ $sMinsText = "минут(а),"; }
elseif ($m_1== "1")
{ $sMinsText = "минут(а),"; } }
$sSecsLeft = $secondfield;
$sSecsText = "секунд(ы)";
$s_1=substr($sSecsLeft,-1,1);
$nSecsLeftLength = strlen($sSecsLeft);
if (substr($sSecsLeft,-2,1)!= 1 && $nSecsLeftLength>1)
{ if ($s_1== 2 || $s_1== 3 || $s_1== 4)
{ $sSecsText = "секунд(ы)"; }
elseif ($s_1== 1)
{ $sSecsText = "секунд(ы)"; } }
if ($nSecsLeftLength==1)
{ if ($s_1== 2 || $s_1== 3 || $s_1== 4)
{ $sSecsText = "секунд(ы)"; }
elseif ($sSecsLeft== "1")
{ $sSecsText = "секунд(ы)"; } }
$displaystring="".
$sDaysLeft." ".
$sDaysText." ".
$sHoursLeft." ".
$sHoursText." ".
$sMinsLeft." ".
$sMinsText." ".
$sSecsLeft." ".
$sSecsText;
if ($timediff<0) $displaystring='С Новым Годом!!!';
echo "$displaystring";
echo "</center>n";
echo "</div>n";
?>