SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,863
    Mentioned
    5 Post(s)
    Tagged
    2 Thread(s)

    A Simple Hit Logger

    I have a cheapy hosting package with Go Daddy and don't get any kind of meaningful stats. I've been using Google Analytics but it isn't completely accurate and doesn't capture search engine bots.

    I tried phpOpenTracker, but they store the IP address as an INT. It's a major pain in the butt to get that back into human-readable form, I guess.

    So my only option is make my own hit logger. I would, at the very least, like to replicate the Apache raw log (something I don't have access to) so I can run it through AWStats or something. I don't know what's in the Apache log or how to replicate it. So I'm looking for a little guidance.

    I know PHP has some superglobals (or whatever they call it) that store variables such as visitor IP address, referrer, browser, OS, etc. I don't know how to access those, so I could use a pointer or two.

    I plan to save the data in a MySQL database. I can handle that part.

    So, all I need is to find out how to replicate the Apache log and which PHP variables to use to do that. Any suggestions?

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the common log format
    http://httpd.apache.org/docs/1.3/logs.html#common

    between the print_r($_SERVER) array of variables, getenv('VAR_NAME'), and date() you should be able to replicate the log file.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might also check this out BBClone

    Here's an example of it running on my site

    http://www.avclan.net/wip/bbclone

    All you do is put a few lines of code at the top of each page and it tracks users and which pages their visiting, how long they're there, and misc. other stats.
    Current Project: Winamp - Online Remote

  4. #4
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,863
    Mentioned
    5 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by avRedline
    You might also check this out BBClone

    Here's an example of it running on my site

    http://www.avclan.net/wip/bbclone

    All you do is put a few lines of code at the top of each page and it tracks users and which pages their visiting, how long they're there, and misc. other stats.
    Thanks for the tip. I shall check it out.

  5. #5
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would also recomend Dans counter. http://w3counter.com
    Its great and has a really nice interface.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •