separator

Take a quiz or make one of your own
Tutorial 3 - Web Hit Counter Using an Image Tag
What It's All About

In the previous tutorial we wrote a Perl program to implement simple counting on a server file. We installed it on the server, set up the data file and then wrote a little webpage. We saved the html file for the page with the SHTML extension so that our SSI enabled Apache server would look for server side include commands embedded in the HTML.

Which means that before the webpage gets sent down to the client machine the server will read it over, looking for something that looks like <!--#exec cgi="article02.cgi"--> and when it finds it, run the program referenced in the 'exec=' command. Of course there are other things that SSI can do but we're not going into that now.

What we'll be looking at in this article is an alternative to using SSI when counting web page hits. If you thought that server side includes were sneaky, how about this? We'll be running our count program from an HTML image tag. But an image tag is for specifying, like, an image. How can you do that?

One of the wonderful things about computer programs is that they can potentially output anything expressible in a digital format. Images, the type that display on web pages certainly fit into that category. Let's see how it's gonna work...

separator

© www.thecgibin.com