Файл: ads/go.php
Строк: 9
<?php
require('./config.php');
$data=date('d.m');
if(!file_exists('./data/update.dat') || trim(file_get_contents('./data/update.dat'))!=$data) {
$db_ads->exec('UPDATE `'.PREFIX.'_ads` SET `today`=0');
$fo=fopen('./data/update.dat', 'w');
fwrite($fo, $data);
fclose($fo);
}
$db_ads->exec('DELETE FROM `'.PREFIX.'_ads` WHERE `end_time`<'.time());
if(empty($_GET['id']) || !$res=$db_ads->query('SELECT `id`, `url` FROM `'.PREFIX.'_ads` WHERE `id`='.abs(intval($_GET['id'])))->fetch(PDO::FETCH_ASSOC)) {
header('Location: /');
exit; }
$db_ads->exec('UPDATE `'.PREFIX.'_ads` SET `today`=`today`+1, `all`=`all`+1 WHERE `id`='.$res['id']);
header('Location: http://'.$res['url']);
?>