disto
09-20-2005, 08:20 PM
ok the problem im using TRIPOD!!!
yes i know its most definatly not ideal and scripting is made very difficult...
i coded a counter script the way it worked was it used variables in the url to set a counter id then just opened/created a txt file called the 'id variable'...
i tried and tested my script on xitami and it worked great however tripod doesnt like it!!
can anyone help?
for a counter on an index page (the id being called 'index') the url was :
http://distouk.tripod.com/cgi-bin/count/count.pl?id=index
the count.pl file containts
---------------------------------
#!/usr/local/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$input{$name} = $value;
}
print "Content-type: text/html\n\n<html>";
$id = $input{'id'};
$txt = ".txt";
open(O1, "<count/opn1.txt");
$o1 = <O1>;
close(O1);
open(O2, "<count/opn2.txt");
$o2 = <O2>;
close(O2);
open(O3, "<count/opn3.txt");
$o3 = <O3>;
close(O3);
open(O4, "<count/opn4.txt");
$o4 = <O4>;
close(O4);
open(O5, "<count/opn5.txt");
$o5 = <O5>;
close(O5);
open(O6, "<count/beg.txt");
$beg = <O6>;
close(O6);
open(O7, "<count/end.txt");
$end = <O7>;
close(O7);
open(C2, "<count/$id$txt");
$lim = <C2>;
close(C2);
open(C1, "<count/$id$txt");
$num = <C1>;
close(C1);
$num++;
open(C1, ">count/$id$txt");
print C1 "$num";
close(C1);
if ($lim eq "") {
&lock;
}
&run;
sub run {
print "<link rel='stylesheet' href='http://distouk.tripod.com/stylesheet1.css' type='text/css'><span id='count'>you are visitor: $num</span>";
exit;
}
sub lock {
open(C3, ">>count/log.pl");
print C3 "$beg<tr><td>$id</td><td>$end\nopen($id$o1$id$o2$id";
print C3 " = <$id$o3$id$o4\n$o5$id$end";
print C3 "\n$beg</td></tr>$end\n\n";
close(C3);
print "<link rel='stylesheet' href='http://distouk.tripod.com/stylesheet1.css' type='text/css'><span id='count'>*you are visitor: $num</span>";
exit;
}
---------------------------------------------
can anyone help?
yes i know its most definatly not ideal and scripting is made very difficult...
i coded a counter script the way it worked was it used variables in the url to set a counter id then just opened/created a txt file called the 'id variable'...
i tried and tested my script on xitami and it worked great however tripod doesnt like it!!
can anyone help?
for a counter on an index page (the id being called 'index') the url was :
http://distouk.tripod.com/cgi-bin/count/count.pl?id=index
the count.pl file containts
---------------------------------
#!/usr/local/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$input{$name} = $value;
}
print "Content-type: text/html\n\n<html>";
$id = $input{'id'};
$txt = ".txt";
open(O1, "<count/opn1.txt");
$o1 = <O1>;
close(O1);
open(O2, "<count/opn2.txt");
$o2 = <O2>;
close(O2);
open(O3, "<count/opn3.txt");
$o3 = <O3>;
close(O3);
open(O4, "<count/opn4.txt");
$o4 = <O4>;
close(O4);
open(O5, "<count/opn5.txt");
$o5 = <O5>;
close(O5);
open(O6, "<count/beg.txt");
$beg = <O6>;
close(O6);
open(O7, "<count/end.txt");
$end = <O7>;
close(O7);
open(C2, "<count/$id$txt");
$lim = <C2>;
close(C2);
open(C1, "<count/$id$txt");
$num = <C1>;
close(C1);
$num++;
open(C1, ">count/$id$txt");
print C1 "$num";
close(C1);
if ($lim eq "") {
&lock;
}
&run;
sub run {
print "<link rel='stylesheet' href='http://distouk.tripod.com/stylesheet1.css' type='text/css'><span id='count'>you are visitor: $num</span>";
exit;
}
sub lock {
open(C3, ">>count/log.pl");
print C3 "$beg<tr><td>$id</td><td>$end\nopen($id$o1$id$o2$id";
print C3 " = <$id$o3$id$o4\n$o5$id$end";
print C3 "\n$beg</td></tr>$end\n\n";
close(C3);
print "<link rel='stylesheet' href='http://distouk.tripod.com/stylesheet1.css' type='text/css'><span id='count'>*you are visitor: $num</span>";
exit;
}
---------------------------------------------
can anyone help?