title: How to make php open a html-file, go two lines up, then write there and close?
body: <p>I am making a litte php-file to log some ip addresses. It is going to write the ips and date/time into a html-file. The html-file is going to be a table. So I want to mak it like this:</p>
  
  <pre><code>&lt;table cellpadding="6" rules="groups"  frame="no"&gt;
  &lt;thead&gt;
  &lt;tr&gt;&lt;th&gt;IP&lt;/th&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Time&lt;/th&gt;&lt;/tr&gt;
  
  &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;tr&gt;&lt;td&gt;192.168.0.1&lt;/td&gt;&lt;td&gt;31. January 2009&lt;/td&gt;&lt;td&gt;19:21:09&lt;/td&gt;&lt;/tr&gt; 
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>So I need it to open the file, write the ip and date/time on the line above <code>&lt;/table&gt;</code>
  I already have the php to write what I want, but it writes a the bottom.</p>
  
  <p>I am very newbie, I don't know what to put in where..</p>
  
  <p>This is what I have:</p>
  
  <pre><code>&lt;?php
  $ip = $_SERVER['REMOTE_ADDR']; 
  $date = date("j. F Y"); 
  $time = date("H:i:s"); 
  $file = fopen('./iplogg.html', 'a', 1); 
  $text="&lt;tr&gt;&lt;td&gt;{$ip}&lt;/td&gt;&lt;td&gt;{$date}&lt;/td&gt;&lt;td&gt;{$time}&lt;/td&gt;&lt;/tr&gt; \n"; 
  fwrite($file, $text); 
  fclose($file); 
  ?&gt;
  </code></pre>