Вход Регистрация
Файл: sys/core/rekl_fiera.php
Строк: 24
<?php


function rekl_fiera()
{
    global 
$set;
#    включаем модуль рекламы от фиеры
if ($set['rekl_key_fiera_on']==1) {
    
$cache = H.'sys/cache/other/ads.php';
    
$bot = (preg_match('#Google-Bot/([0-9]+.[0-9]+)#i', $_SERVER['HTTP_USER_AGENT']) or preg_match('#Yandex-Bot/([0-9]+.[0-9]+)#i', $_SERVER['HTTP_USER_AGENT']) ? true : false);
    if (
file_exists($cache) and (time() - filemtime($cache) < 43200)) {
        
$ads = json_decode(file_get_contents($cache));
    } else {
        
$ads = file_get_contents('http://dcms-fiera.ru/ads/ads.php?key='.$set['rekl_key_fiera'].'&version=2');
        
$fp = fopen($cache, 'w');
        
fwrite($fp, $ads);
        
fclose($fp);
        
$ads = json_decode($ads);
    }
    if (
is_array($ads[0])) {
        
$ads = $ads[ rand(0, count($ads) - 1) ];
    }
    
$name = explode('|', $ads[1]);
    
$name = $name[ rand(0, count($name) - 1) ];
    echo 
'<div class="rekl"><a href="http://'.($bot ? $ads[2] : 'dcms-fiera.ru/ads/ads.php?out=60&id='.$ads[0]).'" target="_blank">'.$name.'</a></div>';
}
}
Онлайн: 2
Реклама