2
I made some mistakes, it works now.
It's pretty simple, I'm ashamed to bother the XOOPS community with my questions
Here is the thing, hopefully it will be usefull to someone :
File /xoops/html/logusernav.php :
$ip_to_log = $_SERVER['REMOTE_ADDR'];
$url_to_log = $_SERVER['REQUEST_URI'];
if ( !$xoopsUser ) {
$uid_to_log = "0";
$uname_to_log = "ANONYMOUS_NONAME";
}
else {
$uid_to_log = $xoopsUser->getVar('uid');
$uname_to_log = $xoopsUser->getVar('uname');
}
$content_to_log = date('Ymd-H:i:s')." ".$ip_to_log." ".$uid_to_log." ".$uname_to_log." ".$url_to_log."n";
$log_file_name = XOOPS_ROOT_PATH.'/logusernav.log';
if (!$log_file_handle = fopen($log_file_name, 'a')) {
echo "";
}
else {
if (fwrite($log_file_handle, $content_to_log) === FALSE) {
echo "";
}
@fclose($log_file_handle);
}
?>
Code to add at the end of /xoops/html/footer.php :
include(XOOPS_ROOT_PATH."/logusernav.php");
It gives you the following logs :
20070110-16:27:46 192.168.1.124 0 ANONYMOUS_NONAME /xoops/html/index.php
20070110-16:28:27 192.168.1.124 5 jcoiron /xoops/html/index.php
20070110-16:29:16 192.168.1.124 5 jcoiron /xoops/html/
20070110-16:29:18 192.168.1.124 5 jcoiron /xoops/html/modules/istats/
20070110-16:36:45 192.168.1.124 5 jcoiron /xoops/html/
20070110-17:42:02 192.168.1.124 5 jcoiron /xoops/html/modules/news/
20070110-17:42:05 192.168.1.124 5 jcoiron /xoops/html/modules/news/article.php?storyid=1279
20070110-17:45:38 192.168.1.124 5 jcoiron /xoops/html/modules/xoopsmembers/
Warning ! This produce
a lot of logs.
If you don't need to keep a record of everything your users do, the module UserVisit is probably what you're looking for :
http://sourceforge.net/project/showfiles.php?group_id=41586&package_id=105497&release_id=207281