show email log entries

'; if (isset($_GET['qid']) && ctype_digit($_GET['qid'])) { $q = "SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `id`='" . safeSQLstr($_GET['qid']) . "'"; $r = ocsql_query($q) or err('Unable to retrieve message'); if (mysql_num_rows($r) == 1) { $l = mysql_fetch_assoc($r); print ' Message ID: ' . safeHTMLstr($l['id']) . '
Queued: ' . safeHTMLstr($l['queued']) . '   (view messages queued at same time)
Sent: '; if (!empty($l['sent'])) { print $l['sent']; } else { print 'Failed to send'; } print '   (re-send message)

To: ' . safeHTMLstr($l['to']) . '
Subject: ' . safeHTMLstr($l['subject']) . '

' . safeHTMLstr($l['body']) . '
'; } else { warn('Unable to find message'); } } elseif (isset($_GET['lid']) && ctype_digit($_GET['lid'])) { $q = "SELECT `" . OCC_TABLE_EMAIL_QUEUE . "`.`id`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`sent`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`tries`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`to`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`subject` FROM `" . OCC_TABLE_EMAIL_QUEUE . "`, `" . OCC_TABLE_LOG . "` WHERE `" . OCC_TABLE_LOG . "`.`logid`='" . safeSQLstr($_GET['lid']) . "' AND `" . OCC_TABLE_LOG . "`.`datetime`=`" . OCC_TABLE_EMAIL_QUEUE . "`.`queued` ORDER BY `id`"; $r = ocsql_query($q) or err('Unable to retrieve log entries'); if (mysql_num_rows($r) > 0) { $displayed = true; print ''; $row = 1; $failed = 0; while ($l = mysql_fetch_assoc($r)) { print '\n"; if ($row == 1) { $row = 2; } else { $row = 1; } } print '
IDSentToSubject
' . safeHTMLstr($l['id']) . ''; if (!empty($l['sent'])) { print $l['sent']; } else { print 'Failed to send'; $failed++; } print '' . safeHTMLstr($l['to']) . '' . safeHTMLstr($l['subject']) . "

Log entries are shown in Coordinated Universal Time (UTC)

'; if ($failed > 0) { print '
'; } } else { warn('No messages found'); } } else { warn('Invalid ID'); } printFooter(); ?>