title: adding counter to php page to count the unique visitors
body: <p>I want to add a counter in my webpage which counts the number of visitors.
  But my problem is that when i refresh my page ,counter increases by 1..i want that counter increases only when a new visitor with another ip reaches to my webpage.
  here are my codes..
  Sorry for my weak english</p>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>   &lt;?php
  session_start();
  
  $ip = $_SERVER['REMOTE_ADDR']; 
  $_SESSION['current_user'] = $ip;
  
  
  if(isset($_SESSION['current_user']))
  {
      $count = file_get_contents("counter.txt");
      $count = trim($count);
      $fl = fopen("counter.txt","w+");
      fwrite($fl,$count);
      fclose($fl);
  
  
  }
  
  else
  {
      $count = file_get_contents("counter.txt");
      $count = trim($count);
      $count = $count + 1;
      $fl = fopen("counter.txt","w+");
      fwrite($fl,$count);
      fclose($fl);
  
  }
  </code></pre>