
patk
Deleted
Feb 3, 2000, 10:48 AM
Post #9 of 9
(1906 views)
|
Well, you are trying to return graphics! I have my own graphics counter that will return graphics: ##################################### #!/usr/bin/perl # The HTTP path to images: $pathtoimages = "http://omega.uta.edu/~jdr3317/count/"; # The UNIX path to the counter. $pathtocounter = "counter.ing"; # How many digits shall count.cgi show? $number_of_digits = "01"; # What is the extension of the images? $end = ".gif"; if (! $pathtocounter) { open(DATA,">$pathtocounter"); print DATA ""; close(DATA); } print "Content-type: text/html\n\n"; open (COUNTER, "$pathtocounter"); $count = <COUNTER>; chop ($count) if $count =~ /\n$/; close (COUNTER); $count += 1; open (COUNTER, ">$pathtocounter"); print COUNTER ("$count"); close (COUNTER); @digits = split(//, $count); if ($number_of_digits eq "") { $howmany = @digits; } else { $howmany = $number_of_digits; } $spline = '%0' . $howmany . 'd'; $count = sprintf("$spline", $count); @digitimages = split(//, $count); foreach $digitimage (@digitimages) { $image = "<img src=$pathtoimages" . "$digitimage" . "$end>\n"; print ("$image"); } exit; ################################ But you need graphics of up to 0 to 9 which there are millions at http://www.digitmania.holowww.com/ I revised the counter below that works with JavaScript, I forgot about the document.write(""); ####################################### #!/usr/bin/perl # Define database. $data = "path/to/database.db"; # If the database doesn't exist, make it. if (! $data) { open(DATA,">$data"); print DATA "0"; close(DATA); # If it's already made, add new count: } else { # Grab old count open(FILE,"$data"); $count = <FILE>; close(FILE); # Add 1 to $count. $count += 1; # Save database with new count. open(NEW,">$data"); print NEW "$count\n"; close(NEW); # Return new count. print "Content-type:text/html\n\n"; print "document.write(\"$count\")\;\n"; exit; } <Script Language="JavaScript" src="counter.cgi"> <!-- //--> </script> ######################################### Ok, to call a script with SSI, try inserting this into a html file: <!--#exec cgi="count.cgi"--> or <!--#include virtual="count.cgi"--> both of those are SSI. I hope that helps.
|