title: PHP fwrite() not writing to log file
body: <p>as one of my first PHP projects I'm creating an IP logging script that logs a user's IP address. For some reason my fwrite() function doesn't seem to be writing to my logfile. </p>
  
  <p>Can someone help me out?</p>
  
  <pre><code>&lt;?php
  // IP Logger Script
  // By Sam Lev
  // sam@levnet.us
  $iplogfile = 'iplog.txt';
  $ipaddress = $_SERVER['REMOTE_ADDR'];
  $webpage = $_SERVER['SCRIPT_NAME'];
  $timestamp = date('m/d/Y h:i:s');
  $browser = $_SERVER['HTTP_USER_AGENT'];
  $fp = fopen($iplogfile, 'a+');
  chmod($iplogfile, 0777);
  fwrite($fp, '['.$timestamp.']: '.$ipaddress.' '.$webpage.' '.$browser. "\r\n");
  fclose($fp);
  echo "IP ADDRESS: $ipaddress &lt;br /&gt;\n";
  echo "TIMESTAMP: $timestamp &lt;br /&gt;\n";
  echo "BROWSER: $browser &lt;br /&gt;\n";
  echo "Information logged to server. &lt;br /&gt;\n";
  ?&gt;
  </code></pre>
  
  <p>iplog.txt is still blank after running the script. Everything echos out fine.</p>
  
  <p>Thanks</p>