<?php
function getCounter() {
	$count_my_page = ("hitcounter.txt");
	$hits = file($count_my_page);
	echo $hits[0];
}

if (isset($_GET["addOne"])) {
	if (!isset($_SESSION["visited"])) {
		$count_my_page = ("hitcounter.txt");
		$hits = file($count_my_page);
		$hits[0] ++;
		$fp = fopen($count_my_page , "w");
		fputs($fp , "$hits[0]");
		fclose($fp);
		$_SESSION["visited"] = 1;
	}
}
?>