Вход Регистрация
Файл: public_html/go.php
Строк: 40
<?php
define
('BASE_DIR'$_SERVER['DOCUMENT_ROOT']);
define('TIME'time());

require_once(
BASE_DIR.'/inc/init.php');

if (isset(
$_GET['type']) && isset($_GET['id']) && isset($_GET['token']))
{
  
$id = (int)$_GET['id'];  
  
$type = (int)$_GET['type'];
  
$token $_GET['token'];
  
  switch (
$type
  {
    case 
'1':

    
$query $mysqli->query("SELECT `time_add`, `user_blocks`, `url_site`, `stats` FROM `".PREFIX."_links` WHERE `id` = '".$id."' LIMIT 1");    
  
    if (
$query->num_rows)
    {
      
$res $query->fetch_assoc(); 
      
      
$stats json_decode($res['stats'], true);
      
      
$n 0;
      
$d '';
     
      
$curr_date date("Y-m-d"TIME);
      
      while(
$d != date("Y-m-d"strtotime($res['time_add'])))
      {
        
$d date("Y-m-d"TIME - ($n 86400));
       
        if (!isset(
$stats[$d]))
        { 
          
$stats[$d] = 0;
        }
        
        if (
$d == $curr_date)
        {
          
$stats[$d] += 1;
        }
       
        
$n++;
      }
      
      
$mysqli->query("UPDATE `".PREFIX."_users` SET `click_links` = `click_links` + '1' WHERE id = '".$res['user_blocks']."'"); 
      
      
$mysqli->query("UPDATE `".PREFIX."_links` SET `stats` = '".json_encode($stats)."' WHERE id = '".$id."'"); 
      
      exit(
header('Location: '.$res['url_site']));    
    }    

    break;

    case 
'2':

    
$query $mysqli->query("SELECT `time_add`, `user_blocks`, `url_site`, `stats` FROM `".PREFIX."_banners` WHERE `id` = '".$id."' LIMIT 1");    
  
    if (
$query->num_rows)
    {
      
$res $query->fetch_assoc(); 
      
      
$stats json_decode($res['stats'], true);
      
      
$n 0;
      
$d '';
     
      
$curr_date date("Y-m-d"TIME);
      
      while(
$d != date("Y-m-d"strtotime($res['time_add'])))
      {
        
$d date("Y-m-d"TIME - ($n 86400));
       
        if (!isset(
$stats[$d]))
        { 
          
$stats[$d] = 0;
        }
        
        if (
$d == $curr_date)
        {
          
$stats[$d] += 1;
        }
       
        
$n++;
      }
      
      
$mysqli->query("UPDATE `".PREFIX."_users` SET `click_banners` = `click_banners` + '1' WHERE id = '".$res['user_blocks']."'"); 
      
      
$mysqli->query("UPDATE `".PREFIX."_banners` SET `stats` = '".json_encode($stats)."' WHERE id = '".$id."'"); 
      
      exit(
header('Location: '.$res['url_site']));
    }  
        
    break;

    default:
        
        
        
    break;
  }
  
}

header('Location: http://'.$_SERVER['HTTP_HOST']);
Онлайн: 0
Реклама