<?php
include("databaseinfo.php");
$ip = $_SERVER["REMOTE_ADDR"];
if ($nolog !=1) {
$sql = "INSERT INTO accesslog (ip, page, section) VALUES ('$ip','$PHP_SELF','$section')";
$result = @mysql_query($sql);
?>
I use that and include it in every page on my site after I set 2 variables, $page and $section, so I know what pages where visited and by who and in what order.
It stores all the info in a database table:
CREATE TABLE accesslog (
time timestamp(14) NOT NULL,
ip varchar(255) NOT NULL default '',
page varchar(255) NOT NULL default '',
section varchar(255) NOT NULL default '',
PRIMARY KEY (time)
) TYPE=MyISAM;
It works well. I also have a page which gives a summary to anyone who wants to look so they can see what info is gathered.
Hope that helps
- Matt