here is the entire code
it works but no .gif files appear?????
i set permissions to 775 on all .gif's the counter.txt file and the .pl and .cgi 
programs????

ideas ????

if i didn't want to use the .gif's could i put a 
print "counter.txt";
somewhere????



#!/usr/bin/perl -w
use strict;

####################################
# Setup begin
$hompage = "/home/thx-1138/";

$counterfile = "$homepage counter.txt"; #Full file path of counter.txt

$imagefile{'0'}="$homepage 0.gif"; #Full file path of 0.gif
$imagefile{'1'}="$homepage 1.gif"; #Full file path of 1.gif
$imagefile{'2'}="$homepage 2.gif"; #Full file path of 2.gif
$imagefile{'3'}="$homepage 3.gif"; #Full file path of 3.gif
$imagefile{'4'}="$homepage 4.gif"; #Full file path of 4.gif
$imagefile{'5'}="$homepage 5.gif"; #Full file path of 5.gif
$imagefile{'6'}="$homepage 6.gif"; #Full file path of 6.gif
$imagefile{'7'}="$homepage 7.gif"; #Full file path of 7.gif
$imagefile{'8'}="$homepage 8.gif"; #Full file path of 8.gif
$imagefile{'9'}="$homepage 9.gif"; #Full file path of 9.gif
#Setup end
############################
$|=1;
@querys = split(/&/, $ENV{'QUERY_STRING'});
foreach $query (@querys) {
   ($name, $value) = split(/=/, $query);
   $FORM{$name} = $value;     
}
$position="$FORM{'position'}";

open(NUMBER,"$counterfile");
$number=<NUMBER>;
close(NUMBER);

$number++;
if ($position==1) {
   open(NUMBER,">$counterfile");
   print NUMBER "$number";
   close(NUMBER);
}

if (($position>0) && ($position<=length($number))) {
   $positionnumber=substr($number,(length($number)-$position),1);
}
else {
   $positionnumber="0";
}
if ($imagefile{$positionnumber}) {
   $imagereturn=$imagefile{$positionnumber};
}
else {
   $imagereturn=$imagefile{'0'};
}

print "Content-type: image/gif\n\n";

open(IMAGE,"<$imagereturn");
print <IMAGE>;
close(IMAGE);
exit 0;



Reply via email to