Made a small adjustment to my previous code, since the list was getting so incredibly large >.>
Its probably not the cleanest way of doing it but it works. And this code only displays the list for the current month and at the bottom shows the total amount of spam.
To use it create a new file with the code below.
And change the following lines to suite your forum.
The path to your forum (if its in the root simply make it ./global.php and ./sfs_log.php)
require "./forum/global.php";
$logInfo = file_get_contents('./forum/sfs_log.php');
Change the timezone to yours/your forums one:
date_default_timezone_set('Europe/Amsterdam');
List can be found here:
http://php.net/manual/en/timezones.php
And the group ID's of the people allowed to view the page:
if ( ($mybb->user['usergroup'] == "4") or ($mybb->user['usergroup'] == "3") or ($mybb->user['usergroup'] == "6") )
You can allow as many group or as little amount of groups as you wish (simply remove/add them using [or ($mybb->user['usergroup'] == "X")] where x is the group id number)
<?php
define('IN_MYBB', 1);
require "./forum/global.php";
date_default_timezone_set('Europe/Amsterdam');
$logInfo = file_get_contents('./forum/sfs_log.php');
$previous = array('Mon,','Tue,','Wed,','Thu,','Fri,','Sat,','Sun,','/ Username:','/ Email:','/ IP:');
$replacements = array('</tr></td><tr><td>','</tr></td><tr><td>','</tr></td><tr><td>','</tr></td><tr><td>','</tr></td><tr><td>','</tr></td><tr><td>','</tr></td><tr><td>','</td><td>','</td><td>','</td><td>');
$cMonth = 0;
$aMonth = 0;
$cDate = date('M Y');
$lCheck = explode('Time:',$logInfo);
if ( ($mybb->user['usergroup'] == "4") or ($mybb->user['usergroup'] == "3") or ($mybb->user['usergroup'] == "6") )
{
echo "<table border='1' cellpadding='5'><tr><th>Time :</th><th>Username :</th><th>E-Mail :</th><th>IP-adress :</th></tr>";
foreach ($lCheck as $cString) {
if (strpos($cString, $cDate) !== false) {
$newString = str_replace($previous, $replacements, $cString);
echo $newString;
$cMonth++;
}
else {
$aMonth++;
}
}
echo "</table>";
$counter = $cMonth+$aMonth;
if($counter !== 0){
echo '<br />Total amount of spam detected: '.$counter.'<br />';
echo 'Total amount of spam this month is: '.$cMonth.'<br />';
echo 'Total amount of spam previous months/years is: '.$aMonth.'<br />';
}else{
echo 'No spam detected';
}
}
else
{
echo "<strong><center>Im sorry to inform you but you have no rights to view this page <br /> If this is incorrect please contact the forum administrator</strong></center>";
}
?>