p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Perl (http://p2p.wrox.com/forumdisplay.php?f=196)
-   -   Problem with CGI Counter (http://p2p.wrox.com/showthread.php?t=40990)

arunmohanmp April 9th, 2006 12:40 AM

Problem with CGI Counter
 
Hi All,

I got a cgi script http://nss.nitc.ac.in/cgi-bin/counter.cgi
When i run this link directly it works. But if i try in one of my html pages (http://nss.nitc.ac.in/html/title.shtml or http://nss.nitc.ac.in/html/title.html) it is not showing the Counter. How can i show the counter in the webpage?

The CGI code am using is

#!/usr/bin/perl
#
# txcounter cgi
# © 2000 Jackie Hamilton - http://www.cgi101.com/
#
# this cgi increments a counter in a file, then prints out a line like
# "You are visitor number XXX."
# HTML code to call this:
#
#
#
# this requires server-side includes. You may need to rename your HTML
# file to a .shtml extension to make it work.
#
# note: be sure that the counter file is set WRITABLE by the httpd
# daemon owner or group. in Unix you'll need to 'chmod 775 countfile'
# or possibly 'chmod 777 countfile'.

$countfile = "/home/nss/web/html/counter";

$count = `cat $countfile`;
chop($count);
$count = $count + 1;
open(INF,">$countfile");
print INF "$count\n";
close(INF);

print "Content-type:text/html\n\n";
print "Visitor: $count.<p>\n";

# the end.

Please suggest a solution...


Thanks and Regards,
Arun Mohan M P


All times are GMT -4. The time now is 08:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.