Advertisement
kaed

unique hit counter p1

May 19th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. <?php
  2.     $filename = 'counter.txt';
  3.     $ip_filename = 'ip.txt';
  4.    
  5.     function inc_count() {
  6.         $ip = $_SERVER['REMOTE_ADDR'];
  7.         global $filename, $ip_filename;
  8.        
  9.         $current_value = (file_exists($filename)) ? file_get_contents($filename) : 0 ;
  10.        
  11.         file_put_contents($filename, ++$current_value);
  12.     }
  13.    
  14.     inc_count();
  15.    
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement