- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
<?php echo '<?xml version="1.0" encoding="utf-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="ru">
<head>
<title>День Победы! 66 лет со дня победы! 9 Мая!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">body{background:#000;}h1{color:#ff5500;}</style>
</head>
<body>
<div style="text-align:center">
<div style="padding-top:28%"><h1><?php
class Main
{
var $timex;
var $month;
var $day;
var $year;
function win2uni($s)
{
$s = convert_cyr_string($s,'w','i');
for ($result='', $i=0; $i<strlen ($s); $i++) {
$charcode = ord($s[$i]);
$result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i];
}
return $result;
}
function Main()
{
if ($this->GetDate())
$this->TimeTo();
return true;
}
function GetDate()
{
$this->month = '05';
$this->day = '09';
$this->year = '2011';
return true;
}
function TimeTo()
{
$m = $this->month;
$d = $this->day;
$y = $this->year;
$mn = date("m");
$dn = date("d");
$yn = date("y");
$hh = date("H");
$mm = date("i");
$ss = date("s");
$diff = mktime(23,59,59,$m,$d,$y)-mktime($hh,$mm,$ss,$mn,$dn,$yn);
$days = $diff/60/60/24;
$hours = $diff/60/60 - intval($days)*24;
$minutes = $diff/60 - intval(intval($days*24)*60);
$seconds = $diff - intval(intval(intval($days*24*60))*60);
$text = "До Дня Победы (9 мая) осталось<br/>\n";
$text.= round($days);
$mins = round($days)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " дней "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " дня "; else
if($mins[strlen($mins)-1] == "1")
$text.= " день "; else
$text.= " дней ";
$text.= round($hours);
if (round($hours) == 1 or round($hours == 21)) $text.= " час "; else
if (round($hours) == 2 or round($hours) == 3 or round($hours) == 4 or round($hours) == 22 or round($hours) == 23) $text.= " часа ";
else $text.= " часов ";
$text.= round($minutes);
$mins = round($minutes)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " минут "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " минуты "; else
if($mins[strlen($mins)-1] == "1")
$text.= " минута "; else
$text.= " минут ";
$text.= round($seconds);
$mins = round($seconds)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " секунд "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " секунды "; else
if($mins[strlen($mins)-1] == "1")
$text.= " секунда "; else
$text.= " секунд ";
echo $text;
return true;
}
}
$X = new Main();
?></h1></div>
я не этнолог и поэтому не особо в курсе
конкретно, в сабже, я бы сказал, что тут модульное программирование (те же процедуры, только в своем "неймспейсе"класса )