#!/usr/bin/perl -wT # count2.pl use strict; use Fcntl qw(:flock); use Untaint; use Image::Size qw(html_imgsize); my $counter = untaint(qr(.*\.dat$), $ARGV[0]); my $style = untaint(qr(^(\.{0,2}/)*?[\w-/]+$), $ARGV[1]); my $SEMAPHORE = $counter . ".lck"; open(S,">$SEMAPHORE") || die "Can't open Semaphore file ($SEMAPHORE): $!"; flock (S, LOCK_EX); open (FILE, $counter) || die "Can't read counter. $!"; my $visits = ; close (FILE); open (FILE, ">$counter") || die "Cant write to counter. $!"; print FILE $visits++; close (FILE); close S; exit unless -d $style; my @digits = split(//,$visits); foreach (@digits) { my $size = html_imgsize("$style/$_.png"); print qq(); }