show ' . (!empty($type) ? safeHTMLstr($type) : '') . ' entries';
$q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `logid`='" . safeSQLstr($_GET['id']) . "'";
$r = ocsql_query($q) or err('Unable to retrieve log entry');
if (mysql_num_rows($r) == 0) {
warn('Log entry not found');
} else {
$l = mysql_fetch_assoc($r);
print 'Date/Time: ' . safeHTMLstr($l['datetime']);
if ($l['type'] == 'email') {
print ' (view individual messages/status)';
}
print '
Type: ' . safeHTMLstr($l['type']) . '
Entry: ' . safeHTMLstr($l['entry']) . '
' . nl2br(safeHTMLstr($l['extra'])) . '
';
}
} else { // all entries
if (isset($_GET['limit']) && ($_GET['limit'] == 0)) { // limit entries?
$limit = '';
} else {
$limit = ' LIMIT 30';
print 'show all ' . safeHTMLstr($type) . ' entries
';
}
// retrieve entries
$q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `type`" . (empty($type) ? "!='sql'" : ("='" . safeSQLstr($type) . "'")) . " ORDER BY `datetime` DESC" . $limit;
$r = ocsql_query($q) or err('Unable to retrieve log entries');
if (mysql_num_rows($r) == 0) {
warn('No log entries were found');
}
// display entries
print '';
$row = 1;
while ($l = mysql_fetch_assoc($r)) {
print '';
if (!empty($l['extra'])) { // extra stuff? if so link it in
print '' . safeHTMLstr($l['datetime']) . '';
} else {
print safeHTMLstr($l['datetime']);
}
print ' | ' . safeHTMLstr($l['type']) . ' | ' . safeHTMLstr($l['entry']) . " |
\n";
if ($row == 1) {
$row = 2;
} else {
$row = 1;
}
}
print '
Log entries are shown in Coordinated Universal Time (UTC)
';
}
printFooter();
?>