Welcome to Geeklog Monday, October 19 2020 @ 08:22 pm EDT

Geeklog Forums

Fix for Daily Digest function and Visitor Stats plugin conflict


Status: offline

shinji

Forum User
Newbie
Registered: 18/03/05
Posts: 3
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

To log them but have 0.0.0.0 for ip address:

FIND:
PHP 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'];
    }
 


AFTER INSERT:
PHP Formatted Code

    if ($REMOTE_ADDR == "") {
       $REMOTE_ADDR = "0.0.0.0";
    }
 


To ignore them completely:

FIND:
PHP Formatted Code

    if ((in_array($_USER['username'],$_ST_USER_IGNORE)) || (in_array($REMOTE_ADDR,$_ST_IP_IGNORE))) {
 

REPLACE WITH:
PHP 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.
 Quote

All times are EDT. The time is now 08:22 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content