title: Trouble making new lines while writing
body: <p>I am making an image that logs the IP of everyone that visits it (for a security). Here is the code:</p>
  
  <pre><code>&lt;?php
  $ip = $_SERVER['REMOTE_ADDR'];
  header("Content-Type: image/png");
  $im = @imagecreate(1, 1);
  $background_color = imagecolorallocate($im, 0, 0, 0);
  $farmerbase = "farmers/" . basename(__FILE__, '.php') . ".txt";
  file_put_contents($farmerbase, $ip . "\n", FILE_APPEND);
  imagepng($im);
  imagedestroy($im);
  ?&gt;
  </code></pre>
  
  <p>How can I make it not log the same IP 3 times, and make sure it puts them on separate lines?</p>