diff --git a/index.php b/index.php index 01ab4ba04..322ad3fc0 100644 --- a/index.php +++ b/index.php @@ -18,46 +18,6 @@ if (isset($_REQUEST['month']) && $roomid) { } } -$file = null; -if (isset($_REQUEST['file']) && $month && $roomid) { - $file = $_REQUEST['file']; - $logfile = $config['logdirectory'] . '/' . $roomid . '/' . $month . '/' . $file; - if (!preg_match('/^[0-9]+-[0-9]+-[0-9]+\.txt$/', $file) || !file_exists($logfile)) { - die('Invalid file specified.'); - } - // record this log access in the database - if ($config['db_server']) { - $db = new mysqli( - $config['db_server'], - $config['db_username'], - $config['db_password'], - $config['db_database'] - ); - $db->query( - 'INSERT INTO `' . - $config['db_prefix'] . - 'logviewerlog` (userid, filename) VALUES (\'' . - $db->real_escape_string($user['userid']) . - '\', \'' . - $db->real_escape_string($roomid . '/' . $month . '/' . $file) . - '\')' - ); - $db->close(); - } - // output the log file - header('Content-Type: text/plain;charset=utf-8'); - if (!isset($_REQUEST['onlychat'])) { - readfile($logfile); - } else { - $lines = file($logfile); - foreach ($lines as &$i) { - if (preg_match('/\|(N|J|L|userstats)\|/', $i)) continue; - echo $i; - } - } - die; -} - ?>