Categorized | News

PHPkitchen Referrers Block Updated

Posted on 24 August 2002 by Demian Turner

The referrers block has been updated, the following improvements are now available:

– fixed bug where empty reflog.txt would break script
– referrers now sorted by hits, from greatest to least
– referrers now have formatted display so long URLs don\’t mess up your page layout
– cron job instructions now included so reflog.txt is wiped at least once every 24 hours

Read \’more\’ for installation instructions.

Bookmark and Share

5 Comments For This Post

  1. geeklog Says:


    I installed that referrer block but it doesn\’t work for me. It looks to
    me that the lgf-reflog.php script doesn\’t write into reflog.txt but if i
    put a url into taht file the refererrer block shows it correct as a
    referrer, otherwise it always tells me \"no referrers yet today\".

    I chowned reflog.txt und semaphore.ref to webserver user
    (wwwrun:nogroup) and entered the correct path to the geeklog dir at
    lgf-reflog.php, anything forgotten?

    PHP 4.2.1
    apache 1.3.26

    Thanx for your help!

  2. demian Says:

    sounds like you\’ve done everything right, I would double check the permissions, even if you\’ve chowned the files make sure write permission is enabled for the apache user:

    chmod u+w reflog.txt

    then come into your site from a referring link to test it. Still failing that, find the following line in your lib-custom.php:

    if(!$rfile = @file($reflog)) {

    and get rid of the \’@\’ error suppression to find out what errors are being thrown.

  3. Anonymous Says:


    The permissions are correct because the web user can write to
    reflog.txt, but if i remove the ‘@’ before “@file($reflog))” then the

    output in the PHP-block at my site is: “could not find reflog file”.

    structure at my geeklog site:

    geeklog/lgf-reflop.php -> $path = ‘/usr/local/WWW/’;


    Thanks for your help!

  4. Anonymous Says:

    and it\’s not the space before miklas that\’s throwing off the path?

  5. geeklog Says:

    Unfortunately not, here is the original code from lgf-reflog.php:

    $path = \’/usr/local/WWW/\’;

    // Name of referrer log file
    $reflog = $path . \’reflog.txt\’;

    // Name of semaphore file
    $semaphore = $path . \’semaphore.ref\’;

    // Maximum number of referrers to log
    $maxref = 50;

    // Domain name of this site (minus \"http://www.\")
    $mydomain = \’\’;

    // From whence did Bunky come?
    $ref = getenv(\"HTTP_REFERER\");

Leave a Reply



Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists



PHPkitchen recommends you also check out the following sites :

Accounting for Small Businesses

FreeAgent sign-up