CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
counter help...

 



tucats
Deleted

Jan 25, 2000, 5:26 AM

Post #1 of 1 (827 views)
counter help... Can't Post

this counter works great, and writes a new file for all webpages AS LONG AS THEY ARE IN THE FIRST SUBDOMAIN... i.e. http://www.kidz4dayz.com/counter.shtml

i need to be able to use the counter "deeper" in the subdomains... i.e. http://www.kidz4dayz.com/testfirstlevel/second/test.shtml

but all i get is repeating the number 1... what can i do to this script to get it to work the way that i want...?


#!/usr/local/bin/perl


$pagepath = $ENV{'DOCUMENT_URI'};

$counter_file = "counter/$pagepath";

print "Content-type: text/html\n\n";

open(FILE, ">>$counter_file");
close(FILE);

open(FILE, "$counter_file");
@indata = <FILE>;
close(FILE);

$onoff = 0;
open(FILE, ">$counter_file");
foreach $temp (@indata)
{
chop($temp);
($uri, $count) = split(/\|/, $temp);
if ($uri eq $pagepath) {
$count++;
$onoff = 1;
print FILE "$uri|$count\n";
print "$count"; }
else { print FILE "$uri|$count\n"; }
}
if ($onoff eq 0) {
print FILE "$pagepath|1\n";
print "1"; }

close(FILE);


thanks so much...




[This message has been edited by tucats (edited 01-25-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives