Little Green Footbal Referrer hack: Display date

Kristine posted on her blog a few weeks ago that she added the date/time to the show referrers. Since I can’t see another toy and not know how it’s done (and have it for myself) - I figured out how to do it…

First (obviously) if you haven’t already, you’ll need to grab the original code from here.

Then, open up lgf-reflog.php. Where you see these lines:

if (count($rfile) == $maxref)
array_pop($rfile);

add this line just below it

$ref = date(”F j, Y, g:i a”).” ||| “.$ref;

Then open up show-refs.php

Change(replace) this:

$r = chop($r);
if ($r <> “Direct request”) echo “<a href=\”$r\”>$r</a><br />\n”;

to this:

$r = chop($r);
$rpieces = explode(” ||| “, $r);
if (count($rpieces) >1) {
if ($r <> “Direct request”) echo “$rpieces[0] : <a href=\”$rpieces[1]\”>$rpieces[1]</a><br />\n”;
} else {
if ($r <> “Direct request”) echo “<a href=\”$r\”>$r</a><br />\n”;
}

To change how the date is displayed - you can change that first part:
date(”F j, Y, g:i a”). Just go here to see the different ways dates can be displayed - what you put in between the (” and the “) after ‘date’ will determine how it gets displayed…

22 Responses to “Little Green Footbal Referrer hack: Display date”

  1. Eve Says:

    Worked perfectly!! Thank you so much. I was just looking for such a thing!

  2. Neurotic Fishbowl Says:
    Displaying Dates in LGF’s Referral Script
    Those smart girls (and guys) over at Scripty Goddess have a quick, simple change that you can add to Little

  3. kristine Says:

    Well again, I’m sorry, Jenn - nobody seemed interested when I posted on my blog, so I didn’t post it over here. :( I feel like a bad goddess now!!! I’ll look at my version and post anything spectacularly different when I get back!

  4. Jennifer Says:

    Don’t worry about it :) Actually I’m curious if you did your differently. You’ll have to let me know.

  5. kristine Says:

    Well, Jenn’s code is probably cleaner than mine - I’m still a newbie at php, but I’ll post links to mine anyhow :)
    LGF-Reflog
    Show-Refs

    Mine adds the time in as an array, and I shifted the date for the number of hours off from my server time to my time. (personal mod changed it from 50 to 100 referrals and I’m filtering out 4 bots that hit my site - you can read more about how to do that on this site!)

    Hope this helps somebody! :)

  6. Jill Says:

    Thanks for posting all of this! I had been wondering if there was a way for the time/day stamp to be added. And Thanks Kristing for showing how to adjust the time for different time zones… I was just about to ask how to do that. :o)

  7. Jill Says:

    Oh good grief… sorry about my spelling… that is what I get for typing in the dark. LOL

  8. melanie Says:

    mine shows the date and time, the referrer, the ip they came from, and the page they visited.
    I took out the bit that stops it reporting on those coming fromwithin my domain, so that I can see where people go when they get here. Hopefully it will give me an idea of what’s interesting and what’s not.

    I’m at work atm, but if anyone wants to know the extra bits of code I can post back.

  9. Jill Says:

    Oh I would LOVE to know how to grab the IP! Please let me know how you did that. Thanks!

  10. Melanie Says:

    I pinched Kristines idea, and posted text files of my code here <a href=”http://wiccked.com/wish/snippets/lgf-reflog-code.txt”>lgf-reflog</a> and here <a href=”http://wiccked.com/wish/snippets/show-refs-code.txt”>show-refs</a>

    I was even very good and commented it all nicely :)

  11. Jill Says:

    That is awesome! Thanks Melanie!

  12. The Quidnunc: A Myopic Mindfulness Says:
    Updates, etc…
    The referral script is working well. I have added the ‘display date’ feature to it as well. Thanks to the

  13. Donna Says:

    I’m just posting this here in case it helps anyone else - when you paste the longer bit of code into show-refs.php, don’t leave off the trailing bracket, or delete the one that’s already there; there should be two, one right after the other in the altered code. Trial and error…

  14. Daisyhead Says:
    Tweak! Tweak!
    Sundays seem to be my tweak day. Maybe I should lobby to make it a National Tweak Day? So far,

  15. Kymberlie R. McGuire Says:

    This is kind of off-topic, but does anyone know if you can choose URLs to ignore in your list? I’m getting referral spam and would like to filter those out.

  16. Jennifer Says:

    Kymberlie - see this post.

  17. The Unknown Geek Says:
    Datage…
    Thanks to a little hack, the reflog now has dates and times… Lets see how it holds when the Spam…

  18. Live in the Delirious Cool Says:
    Things left behind.
    Oh, and no more WeatherPixie.

  19. Daniel Says:

    Melanie,

    In both your source code files, you have a parse error on line 15. Your opening comment was transposed:

    */ instead of /*

  20. patchwork progression Says:
    MT Tweaks
    Running list (reverse chronology) of modifications made to the default MT installation, links to corresponding snippets or plugins, and other technical changes related to my blog …or yours if you run MT…

  21. DeeDee Says:

    Can someone guide me installing this referrer script? I am confused with the lgf-reblog and show-refs pages. Am I supposed to create another page like example.php? If you can list all the files I need to have in my referrer dir that would be great! Thanks!

  22. Kamilla Says:

    I have searched the original site for the download link but can’t find it anywhere. It seems like a really neat script and I’d like to give it a try.
    Can anyone post the link here?

    Thanks much :)