Fix for Visitor Stats and Daily Digest conflict.
Issue at hand: emailgeeklogstories cron script creates a page hit from the local system. REMOTE_ADDR server variable is undefined and therefore causes gethostbyaddr to report a warning about an invalid ip. This fix sets REMOTE_ADDR to 0.0.0.0 so that it doesn't complain. It should only do it if REMOTE_ADDR is empty. The other idea is to not log them at all. I will provide both instructions.
File to edit (for both instructions): [geeklog_install]/plugins/glstats/functions.inc
Text Formatted Code
function ST_addStats()
{
global $HTTP_USER_AGENT, $REQUEST_METHOD, $REMOTE_ADDR, $QUERY_STRING, $SCRIPT_NAME, $_USER, $_ST_USER_IGNORE, $_ST_IP_IGNORE, $HTTP_REFERER, $_TABLES;
$browser = ST_getBrowser();
if ($_USER['uid'] < 2) {
$usr = 1;
$usern = 'Anonymous';
} else {
$usr = $_USER['uid'];
$usern = $_USER['username'];
}
Text Formatted Code
if ($REMOTE_ADDR == "") {
$REMOTE_ADDR = "0.0.0.0";
}
Text Formatted Code
if ((in_array($_USER['username'],$_ST_USER_IGNORE)) || (in_array($REMOTE_ADDR,$_ST_IP_IGNORE))) {
Text Formatted Code
if ((in_array($_USER['username'],$_ST_USER_IGNORE)) || (in_array($REMOTE_ADDR,$_ST_IP_IGNORE)) || ($REMOTE_ADDR == "")) {
I know others have found other methods of fixing this but I have not been able to get them to work including setting emailgeeklogstories as an ignored file with both just the filename and the full path. The cron script resides outside the html directory but even if I placed it within the html directory Visitor Stats plugin still doesn't know what file it logged (the field is blank in the database). This error was occuring when the hit was being logged in the userstats table. So bad entries in the database had nothing to do with this one.