Вход Регистрация
Файл: _modules/cn/index.php
Строк: 41
<?php

    
# mark core  v1.0
    # author Drk in
    # date 24.10.19     

    # core

    
require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );

    require_once ( 
inc."Mobile_Detect.php" ); # class Mobile_Detect 

    
$type = isset( $_GET['type'] ) ? system::check($_GET['type']): null;

    
$type = ($type == 'small' ? 'small':'big');    

    
$id =  isset( $_GET['id'] ) ? system::abs($_GET['id']): 0;

    
date_default_timezone_set('UTC');

    if (
cache_pf::ch($id) === true):

    
$act = cache_pf::check($id);    

    if (
$act['ban'] == 0): if ($act['mode'] == 0):

    
$to = mktime(0, 0, 0, date('m'), date('d'), date('Y'));    

    
$hs = DB :: $dbh -> querySingle("SELECT count(id) FROM hs WHERE pf = ? AND ip = ? AND ua =? AND time > ?", array($id,ip,ua,$to));    

    if (empty(
$hs)): # false
        
    
$detect = new Mobile_Detect;
    
    if (
$detect->isMobile() || $detect->isTablet()): $is = ',mb = (mb + 1),mb_all = (mb_all + 1)';endif;

    if (!
$detect->isMobile() && !$detect->isTablet()): $is = ',pc = (pc + 1),pc_all = (pc_all + 1)'; endif;    

    
DB :: $dbh -> query("INSERT INTO hs (pf,ip,ua,time) VALUES (?,?,?,?);",array($id,ip,ua,time()));    

    
DB :: $dbh -> query("UPDATE platforms SET hs = (hs + 1),hs_all = (hs_all + 1) {$is} WHERE id = ? LIMIT 1;", array($id));        

    endif;
        
    
DB :: $dbh -> query("INSERT INTO ht (pf,ip,ua,time) VALUES (?,?,?,?);",array($id,ip,ua,time()));

    
DB :: $dbh -> query("UPDATE platforms SET ht = (ht + 1),ht_all = (ht_all + 1) WHERE id = ? LIMIT 1;", array($id));        

    
$on = DB :: $dbh -> querySingle("SELECT count(id) FROM `on` WHERE pf = ? AND ip = ? AND ua =?", array($id,ip,ua));    

    if (empty(
$on)): # false

    
DB :: $dbh -> query("INSERT INTO `on` (pf,ip,ua,time) VALUES (?,?,?,?);",array($id,ip,ua,time()));

    else: 
# true

    
DB :: $dbh -> query("UPDATE `on` SET time = ? WHERE pf = ? AND ip = ? AND ua =? LIMIT 1;", array(time(),$id,ip,ua));

    endif;    

    
cache_pf::save($id);    

    
$img = root.'css/i/cn/'.$type.'/'.$act[$type].'.gif';

    
$tx_hs = $act['hs']; # HOST
    
$tx_ht = $act['ht']; # HITS

    
$img = imagecreatefromgif($img);

    
$font = root.'css/i/cn/fonts/font.ttf'; 
    
    
$font_size = 7;

    
$color = imageColorAllocate($img, 0, 0, 0);

    
imagettftext($img, $font_size, 0, 3, 23, $color, $font, $tx_hs);
    
imagettftext($img, $font_size, 0, 39, 23, $color, $font, $tx_ht);

    
# error

    
else: $img = root.'css/i/cn/'.$type.'/mod.gif'; $img = imagecreatefromgif($img); endif;
    else: 
$img = root.'css/i/cn/'.$type.'/ban.gif'; $img = imagecreatefromgif($img); endif;
    else: 
$img = root.'css/i/cn/big/mod.gif'; $img = imagecreatefromgif($img); endif;

    
header("Content-type: image/gif");

    
imagegif($img);

    
imageDestroy($img);
?>
Онлайн: 1
Реклама