#1
  1. Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    49
    Rep Power
    15
    hi,

    i was writing a system to track users on my site using cookies, php and mysql when a friend said he had heard that one could make use of the apache log files to do a similar system. At the moment, i have just 2 tables to do this: one holding the cookie info, (with alias, email, user ID etc....), and one with the pages hit (with 2 columns, one with the user ID and another with the url of the page which has been visited).

    Unfortunately, that friend did not specify how to do this. He said something about reading the apache log files into a table regularly, using mod_usertrack. I guess that would mean parsing the info out of that log file and onto the database and using that instead of my second table... would this be a good idea ? And how exactly would i do it ?

    nick
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    59
    Rep Power
    15
    If you just look at your logfile, it probably wouldn't take long to figure out, I would probably first read the file in with

    $apache_log = file("/www/logs/access_log");

    each line of the apache log file is a different request made to the web server, the line goes

    IP - - [DATE] "Request"

    I would then just parse that into columns in a MySQL database, and be done with it, but you could do formatting, or tracking IP's, how many request to a certain file, etc.

    Chris
  4. #3
  5. Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    49
    Rep Power
    15
    hi,

    thanks a lot for your advice - at least now i know how the log file works

    The way I have it at the moment though is that I use both cookies and a databse to keep track of users. This means that I have a database info such as the users' IP address, email/alias if they have provided them, etc..., and a unique ID number. This ID number is then stored in the cookie. Do you know of a way I could maybe link the log files to each users' info in the database ? I would then be able to find out which user logged into which page and when...

    thanks for any help anyone can give
    nick

Similar Threads

  1. Mysql problem.
    By Nik in forum MySQL Help
    Replies: 54
    Last Post: December 21st, 2006, 06:02 PM
  2. Copying Mysql files from one box to another
    By 88guy in forum MySQL Help
    Replies: 1
    Last Post: January 25th, 2004, 12:33 AM
  3. Help Needed With MySQL Search...
    By CoasterLine in forum PHP Development
    Replies: 5
    Last Post: January 24th, 2004, 11:23 PM
  4. Way to load files with different names into MySQL?
    By abrahamvionas in forum MySQL Help
    Replies: 1
    Last Post: January 19th, 2004, 09:59 PM

IMN logo majestic logo threadwatch logo seochat tools logo