Shtirlitz
Зарегистрирован:
|
Добавлено: 14/12/00 в 00:23
|
re: Подскажите пожалста счетчик на exit-трафф #!/usr/bin/perl use IO::File; use strict; my $redirecttxt; my $ParamList; my $ParamName; my $ID; my $RedirectNUM; my $RedirectURL; my $PathToLogFile; my $LogFilePrefix; my ($mday, $mon, $year, $sec, $min, $hour); my $LogFileName; my $LogFileHandler; my $Comment; $redirecttxt = new IO::File "< redirect.txt"; $PathToLogFile = "/usr/home/dabest/redirect.logs/"; $LogFilePrefix = "redirect"; ($sec, $min, $hour, $mday, $mon, $year) = (localtime())[0,1,2,3,4,5]; $year += 1900; $mon += 1; $LogFileName = $PathToLogFile . $year . "-" . $mon . "-" . $mday . "-" . $LogFilePrefix . ".log"; #print "$LogFileName "; $LogFileHandler = new IO::File ">> $LogFileName"; $ParamList = $ENV{'QUERY_STRING'}; ($ParamName, $ID) = split (/=/, $ParamList); if ($ParamName eq "id") { while(<$redirecttxt>) { chomp; ($RedirectNUM, $RedirectURL, $Comment) = split (/,/, $_); if ($RedirectNUM == $ID) { print ("location:$RedirectURL "); print $LogFileHandler "$mon-$mday-$year,$hour:$min:$sec,$ID,$RedirectURL,$Comment "; last; } } }
|