PDA

View Full Version : Tracking File Access



Strangeplant
09-11-2006, 02:56 PM
I want to create a log of files accessed on the server from a php page that executes DOM html in the browser via a window.open=() call. Can this be done with the rest of the page intact?

I have the log file created and the write code that executes fine from the beginning php part, but how would I go about it from the browser page? Could I do it from an included javascript routine like:
(snip)....
if (newwindow==1)
{
window.open=(selectedOptionvalue);
<?
$myFile = "DataAccess.log";
$fh = fopen($myFile, 'a') or die('cannot open file');
$stringData = date("Y/m/d H:i:s")." ".$user['user_name']." ".$_SERVER['REMOTE_ADDR']." ".$_SERVER['SCRIPT_FILENAME']."\n";
fwrite($fh, $stringData);
fclose($fh);
?>
}
else
(snip)The only thing is that $user['user_name'] comes from the initial php setup of the webpage. How would I get this back? From sessions? From the cookie?