Location: PHPKode > scripts > PHP Free hit counter > php_hit_counter/hit_counter/agriz_hit_counter.php
<?
/**
*
* @Script Hit Counter
* @version 1.0.0
* @copyright (c) Agrizlive.com
* @license You are allowed to modify this script. But script should have the powered by agrizlive and copyrights
* @Read Instruction http://www.agrizlive.com/instructions/php-free-hit-counter/index.php
* Tested : PHP 5.2.11
*/

/**
*/

	function display_counter($increment)
	{
		$filename = 'agriz_counter.txt';
		//Create file pointer
		$fp = fopen($filename,"r");
		// Read the old counter value
		$counter = fread($fp, filesize($filename));
		fclose($fp);
		
		
		$fp = fopen($filename,"w");
		//Increment the counter
		$counter = $counter + $increment;
		//Write the new value
		fwrite($fp, $counter);
		//close the file
		fclose($fp);
		
		//Output the value to the website
		return "<p class='agriz_hit_counter'><a href='http://www.agrizlive.com' title='free php hit counter' target='_blank'>$counter</a></p>";
	}
?>
Return current item: PHP Free hit counter