Results 1 to 1 of 1

Thread: Tracking File Access

  1. #1
    Join Date
    Feb 2006
    Posts
    236
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default Tracking File Access

    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:
    Code:
    (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?
    Last edited by Strangeplant; 09-11-2006 at 03:21 PM. Reason: more to add

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •