Вход Регистрация
Файл: public_html/anecdotes/foot.php
Строк: 145
<div class="foot">Сайту 
<?php
// 25 января 1985 года
  
$birthday = mktime(0, 0, 0, 2, 19, 2015);
  echo 
birthday($birthday);

  
// Количество лет, месяцев и дней, прошедших со дня рождения
  
function birthday($sec_birthday)
  {
    
// Сегодняшняя дата
    
$sec_now = time();
    
// Подсчитываем количество месяцев, лет
    
for($time = $sec_birthday, $month = 0; 
        
$time < $sec_now; 
        
$time = $time + date('t', $time) * 86400, $month++){
        
$rtime = $time;
        }
    
$month = $month - 1;
    
// Количество лет
    
$year = intval($month / 12);
    
// Количество месяцев
    
$month = $month % 12;
    
// Количество дней
    
$day = intval(($sec_now - $rtime) / 86400);
    if(
$year>0)
{
    
$result = declination($year, "год", "года", "лет")." ";
    }
    if(
$month>0)
{
    
$result .= declination($month, "месяц", "месяца", "месяцев")." ";
    }
    if(
$day>0)
{
    
$result .= declination($day, "день", "дня", "дней")." ";
    }
    return 
$result;
  }
print 
'<br>';
  
// Склонение числа $num
  
function declination($num, $one, $ed, $mn, $notnumber = false)
  {  
    
// $one="статья";  
    // $ed="статьи";  
    // $mn="статей";  
    
if($num === "") print "";
    if((
$num == "0") or (($num >= "5") and ($num <= "20")) or preg_match("|[056789]$|",$num))
      if(!
$notnumber)
        return 
"$num $mn";
      else
        return 
$mn;
    if(
preg_match("|[1]$|",$num))
      if(!
$notnumber)
        return 
"$num $one";
      else
        return 
$one;
    if(
preg_match("|[234]$|",$num))
      if(!
$notnumber)
        return 
"$num $ed";
      else
        return 
$ed;
  }
  
$array=array
(
'<a href="/"><font color="red">Mc_Laren &copy; 2015 г.</font></a>','<a href="/"><font color="blue">Mc_Laren &copy; 2015 г.</font></a>','<a href="/"><font color="black">Mc_Laren &copy; 2015 г.</font></a>','<a href="/"><font color="yellow">Mc_Laren &copy; 2015 г.</font></a>');
echo
$array[rand
(0,3)];
?>


<?
$link
=file
("file.txt");
$LinkCount=count
($link);
$NL=rand(0,
$LinkCount-1);
echo
$link[$NL];
?>
</div>
<?
session_save_path
("/path/to/custom/directory");
session_start();
define("MAX_IDLE_TIME", 3);
function 
getOnlineUsers(){
if ( 
$directory_handle = opendir( session_save_path() ) ) {
$count = 0;
while ( 
false !== ( $file = readdir( $directory_handle ) ) ) {
if(
$file != '.' && $file != '..'){
if(
time()- fileatime(session_save_path() . '' . $file) < MAX_IDLE_TIME * 60) {
$count ;
}
} }
closedir($directory_handle);
return 
$count;
} else {
return 
false;
}}
echo 
'<img src='/img/ico/online.png' width='16' height='16' alt=''/> ' . getOnlineUsers() . '
'
;?>

<?php
$digits 
= 6;
//Определяет кол-во показываемых чисел – в этом случае 00000x.
$filelocation="entercounter.txt";
//Имя файла счетчика. Если хотите изменить на другое, замените здесь и переименуйте .txt файл.
if (!file_exists($filelocation)) {
$newfile = fopen($filelocation,"w+");
$content=1;
fwrite($newfile, $content);
fclose($newfile);
}
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
$newfile = fopen($filelocation,"w+");
if (!
$c){
$content++;
}
fwrite($newfile, $content);
fclose($newfile);
echo 
"<br><img src='/img/ico/eye.png' width='16' height='16' alt=''/> ".sprintf ("%0"."$digits"."d",$content)."";
//Если вы хотите, чтобы какой либо текст был вокруг счетчика, заключите строку выше в цитатные кавычки (quotation marks).
?>
    </body>
</html>
Онлайн: 1
Реклама