1
I couldn't find a hack to log into a file the users connections/browsing. So I put the following in a file named logusernav.php :
<?php print "<!-- Beginning user log -->"; if ( !$xoopsuser ) { $user_to_log = "Anonymous usern"; } else { $user_to_log = "User ID: ".$xoopsUser->getVar('uid')."n"; } $content_to_log = $date('Ymd-H:i:s')." ".$user_to_log." n"; $log_file_name = XOOPS_ROOT_PATH.'logusernav.txt'; if (!$log_file_handle = fopen($log_file_name, 'a')) { echo "<!-- Cannot open file ($log_file_name) -->"; } else { if (fwrite($log_file_handle, $content_to_log) === FALSE) { echo "<!-- Cannot write to file ($log_file_name) -->"; } @fclose($log_file_handle); } ?>
But if I include it in the main index.php or footer.php it does nothing. It doesn't even print "Beginning user log".
I added :
le="color: #000000"><?php echo "<!-- nnn ----------------------include loguservnav ----------------nn -->"; include "logusernav.php"; echo "<!-- nnn ----------------------fin include loguservnav ----------------nn -->";
in footer.php just one line before the final "?>". It does add the comments, "include loguservnav" and the rest, but nothing from logusernav.php .
Can anyone give me a hint ? I'm curently connected to #xoopssupport and would really appreciate any help.
The logs I'm looking to obtain is :
[timestamp] userIP userid username url
I Hope I posted in the right place.