First off all you need your page to be a .php for example index.php then you would need to open up dreamweaver or what ever you use and create a .php then put this in it: <?php $visit = fopen("log.txt","r"); $counter = fgets($visit,1000); fclose($visit); $counter=$counter + 1 ; echo "$counter" ; $visit = fopen("log.txt","w"); fwrite($visit, $counter); fclose($visit); ?> Then save it as hits.php, Now open up the page you would like to count the hits on and place this code in <? include ("hits.php"); ?> Now have you noticed in that php above you can see a file name called log.txt, This is the file that your hits store in. Now you need to create a file on your webserver and name it list.txt. Give it permissions to read and write. save and upload, Enjoy! You cannot create a counter using html, Well of my knowledge Hope that helps you alot!
Nice code from ajohn03d. And of course, you cannot create counter with html itself. Because, you need to store a value of counter some common place . For that you need a server place. Hence server place means , automatically you need any server script. The above code is good, may need some tweak when you run it on server, like 777 chmod for the file etc. Anyways, try your best from some search in google. Best Regards, Nirmal
Outside of needing more complicated code than HTML, as a general rule of thumb counters are a bad idea. You will be showing people how "unpopular" your website is, until it is "popular". It's anti-marketing. Most hosting companies supply web statistics software as part of their hosting package. You can find out how many people visited your site, and which pages using that. Ask your host about which web statistic software you have access too. Good luck
The code given should work on any server where php is enabled. But as xira said it is not advisable. You can also install a counter using some html code if your host gives this facility. Like in cpanel theres an inbuilt script where you just need to add a line of html code and your are done.
Hey alisha0512, You can get a free html counter at statcounter, it in my opinion is the best and of course its free. It has various trackers, you can also see how long a visitor stays on any given page, what keywords they used to get to your website. Check it out. Yours, Laura_D