Remove outdated logging code

This commit is contained in:
Guangcong Luo 2016-05-02 17:17:07 -04:00
parent a040289eae
commit 08db10f5ce

View File

@ -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;
}
?>
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />