Файл: public_html/lincode.php
Строк: 38
<?php
define('BASE_DIR', $_SERVER['DOCUMENT_ROOT']);
define('TIME', time());
require_once(BASE_DIR.'/inc/init.php');
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$query = $mysqli->query("SELECT * FROM `".PREFIX."_blocks` WHERE `type` = '1' and `id` = '".$id."' LIMIT 1");
if ($query->num_rows)
{
$res = $query->fetch_assoc();
$stats = json_decode($res['stats'], true);
$ip = $_SERVER['REMOTE_ADDR'];
$query = $mysqli->query("SELECT `id` FROM `".PREFIX."_blocks_view` WHERE `time_add` >= CURDATE() and `ident` = '".$id."' and `ip` = '".$ip."' LIMIT 1");
if ($query->num_rows)
{
$res_view = $query->fetch_assoc();
$mysqli->query("UPDATE `".PREFIX."_blocks_view` SET `view` = `view` + 1 WHERE `id` = '".$res_view['id']."' and `ip` = '".$ip."'");
@$stats[date("Y-m-d", TIME)]['view'] += 1;
}
else
{
@$stats[date("Y-m-d", TIME)]['user'] += 1;
@$stats[date("Y-m-d", TIME)]['view'] += 1;
$mysqli->query("INSERT INTO `".PREFIX."_blocks_view`
(
`ident`,
`time_add`,
`ip`,
`view`,
`type`
)
VALUES
(
'".$id."',
NOW(),
'".$ip."',
'1',
'1'
)");
}
$mysqli->query("UPDATE `".PREFIX."_blocks` SET `stats` = '".json_encode($stats)."' WHERE `id` = '".$id."'");
$query = $mysqli->query("SELECT * FROM `".PREFIX."_links` WHERE `ident` = '".$id."' and `status` = '1' ORDER BY `time_add` DESC");
$links = '';
$razd = $res['vid'] == 2 ? ' '.$res['razd'].' ' : '<br>';
if ($query->num_rows)
{
while ($row = $query->fetch_assoc())
{
$token = md5(TIME.$row['id']);
$text = $row['specc'] == 1 ? '<b style="color:'.$row['color'].';">'.$row['text'].'</b>' : $row['text'];
$links .= '<a href="http://www.tourus.site/go.php?type=1&id='.$row['id'].'&token='.$token.'" target="_blank">'.$text.'</a>'.$razd;
}
}
$code = "var ls = document.getElementById('tourus_".$id."'); var price = document.getElementById('tourus_price_".$id."');ls.innerHTML = '".$links."';if (price)price.innerHTML = '".$res['sum']."';";
exit($code);
}
exit(header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true));