File: /var/www/samok164/data/www2/culture-style.ru/rzgn/r4_getlog.php
<?php
error_reporting(0);
function error($msg = '') {
header('HTTP/1.1 500 Internal Server Error');
exit($msg);
}
if (empty($_GET['engine']))
error('Param engine is empty');
if (!in_array($_GET['engine'], array('yandex', 'google')))
error('Unknown engine: ' . $_GET['engine']);
$r4_logfile = $_SERVER['DOCUMENT_ROOT'] . '/rzgn/seenby' . $_GET['engine'] . '.rzg';
if (!file_exists($r4_logfile))
error('File not found: ' . $r4_logfile);
$action = array_intersect(array('get', 'delete'),
explode(',',
(empty($_GET['action']) ? 'get' : $_GET['action'])
)
);
if (in_array('get', $action))
echo file_get_contents($r4_logfile);
if (in_array('delete', $action))
unlink($r4_logfile);