#!/usr/local/bin/perl # # program name : gacs0.cgi(graphic access counter for secondary Web page # without counting up) # # function : Send secondary Web page HTML data with guest number IMG tags. # But this cgi does not increment count number. This cgi is # for link from internal web page. # # programmer : makoto takenaka (takesoft@mxs.meshnet.or.jp) # # copyright : (c) 1996 by Takesoft # # version(date) : # ver.1.0 (Nov 8, 1996) Made from gacs.cgi(ver 1.0). # Section (1),(3) and error messages are changed. # #(1) set constants to browser. # $html_file = "./main.html"; # Web page html file to be shown $count_file = "./count.txt"; # counter file $gif_dir = "./image/"; # directory of gif files for numbers # #(2) send html file. # print "Content-type: text/html\n\n"; # open(HTML_FILE, $html_file) ||die "gacs0(2): Unable to open $html_file"; # while() { # #(3)If this line contains "INSERT_COUNTER", increment counter # and send guest number. # if ( $_ =~ /INSERT_COUNTER/ ) { open(COUNT_FILE, "$count_file") || die "gacs0(3): Unable to open $count_file"; $count = ; close(COUNT_FILE); # #(4) insert counter image tags. # $nd = length($count); # for ($digit = $nd; $digit > 0; $digit--) { $d = substr($count, (-1)*($digit), 1); # # check $d. # if($d < 0 || $d > 9) {print "gacs0(4): wrong number d, d = $d\n"} else { $gif_file = "$gif_dir$d.gif"; # print "\"$d\""; } } } else { print $_; } } # close(HTML_FILE);