Well if you are using php, the below code might be very much useful for your purpose;
Code:
<?php
$filename = "hitsnum.txt";
$file = file($filename);
$file = array_unique($file);
$numhits = count($file);
echo $numhits;
$fd = fopen ($filename , "r");
$fstring = fread ($fd , filesize ($filename));
fclose($fd);
$fd = fopen ($filename , "w");
$fcount = $fstring."\n".getenv("REMOTE_ADDR");
$fout= fwrite ($fd , $fcount );
fclose($fd);
?>
save this file as count.php. Now make a new file named numhits.txt and save both the count.php and the numhits.txt. Now upload all the files to the server and CHMOD numhits.txt to 777. After this is done, simply place the following code in your main page;
Code:
<?php
include ('counter.php');
?>
All done.. Now just enjoy your counter. Tell me if you need anything else. Happy to help you.
Bookmarks