[Tutor] CGI call

Jon Cosby jcosby@wolfenet.com
Thu, 9 Nov 2000 16:42:26 -0800

I have a simple hit counter and I don't know how to call it from my web
page. Looking at a similar script, I've tried the line

<!--#include virtual="cgi-bin/counter.py" -->,

but this doesn't do it. The script only runs when I link directly to it. The
counter script is below. What do I need to change?

Jon Cosby

print "Content-type: text/html"
print "<HEAD><TITLE>Python Hit Counter</TITLE></HEAD>"
print "<BODY>"

InFile = open("C:\Inetpub\wwwroot\cgi-bin\count.dat", "r")
Hits = InFile.readline()
x = int(Hits) + 1
OutFile = open(DataFile, "w")

print "<P><H2>Jon Cosby's web page - Total hits: ", str(x)
print "</H2></BODY>"

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.209 / Virus Database: 99 - Release Date: 11/2/2000