Forum Moderators: DixonJones
Is this possible, i got a tip that you can use Javascript to do this, how i don't know but he worried that you are not able to write the data in to a file with Javascript anyone have a solution?
The script should be able to run on any webserver which support .html files.
[xav.com...]
It uses SSI includes to exec its script which logs referer, ip, etc in a log file. If you don't have SSI, you can also specify the cgi script call in an image tag - Doesn't work as well because of caching issues.
So basically you write a script that records and writes the info you want, and to an SSI include to that script at the top of each page.
You'll need server side scripting to record the data, there's no getting away from this, but you can get away with using only one instance and consequently avoid turning all your .html pages into scripts.
This is a PHP solution so hopefully you have access to it at your host.
The PHP script would simply gather and record the contents of the environment variables you're interested in; preumably HTTP_REFERER, HTTP_USER_AGENT, REMOTE_ADDR.
You can get all the information you need to do this at php.net. Specific functions are:
fopen() - to open the log file
fwrite() - to write to it
fclose() - to close it
fread() or file() - to read the contents of the log file
Simply point your browser to www.php.net/functionname to access the online manual entry for each "functioname".
Adding this to the <body> of each .html page you wish to track...
<script language="javascript" src="http://www.yourdomain.com/path/to/script.php"> </script>
...willl run the remote script and record the data specific to the page on which the javascript appears.
TIP: Suppress error messages in the server side script by placing an @ symbol before each function call - like this @fopen()
Of course, if you can pick up a pre-written server side script to do the gathering and recording you're laughin'.
Good luck.