Posted on 1999-12-24
Medium Priority
Last Modified: 2010-04-09
How to add a counter to my html where i can to how many people are enter my homepage.
Question by:tonyckx

Expert Comment

ID: 2305033
Dear Tony,
   There are many websites providing free counters to be put up on UR web page. When the food is ready to eat then Y we have to cook???  Hope U understood ....
One of the site is http://counter.mycomputer.com/counter_com_index.html


Expert Comment

ID: 2305209
Another option is to check with your ISP or hosting company.  A lot of them provide cgi counters to the customers.  Just check with the service rep.

Accepted Solution

SuperMario earned 150 total points
ID: 2306215
If you know Perl or CGI, you can always write one like this. Save it as myscript.cgi and upload it into your main directory. Also create a file called counter.txt with simply the number 1 in it.
Here's the CGI script:




sub openCounter {
# open counter text file
open(CNT, "<counter.txt");
$numHits = <CNT>;
$newVal = $numHits + 1;

#open counter again for writing
open(toWrite, ">counter.txt");
print toWrite $newVal;

#print results
print "Content-type: text/html\n\n";
print "Number of people to this page: $newVal";


Then in the body of your HTML, if your web host supports SSI (server-side includes) type this line in:

<!--#exec cgi="/myscript.cgi">

Anyway, if you don't know PERL or CGI, check out your host's site enhancement options. Go to their online site builder, if they have one, and see what kind of goodies they have. Geocities offers great counters. Angelfire does too.

Just see what you can come up with, man!



Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question