%PDF- %PDF-
Direktori : /home/rappan/www/_cgi_ac/access/ |
Current File : /home/rappan/www/_cgi_ac/access/accupdate.pl |
########################################################## # Access Analysis "AshiatoLOG" Ver.2.01 # # Copyright (c) 2000,2001,2002 Funakichi # # All rights reserved. # ########################################################## # ATTENTION:This code is written with "S-JIS" character-set. require "configB.pl"; require 'access.pl'; #昨日のデータを圧縮! $acclog = new AshiatoFile($wrdir, $wrfile, $errfile, $lockfile, $timeout, $trytime, $intime, $updatetm); $acclog->readWriteAccFile($logfile); # データ添付メール発送! if ($mailaddr and $sendmail) { eval 'use Jcode;'; eval 'use MIME::Base64 qw(encode_base64);'; $subject = sprintf("AshiatoLOG %.2d/%.2d/%.2d", $year+1900, $mon+1, $mday); $mailinfo = sprintf("AshiatoLOG %.2d月%.2d日のログファイルを送信します。", $mon+1, $mday); &Jcode::convert(\$mailinfo, 'jis'); $fname = $logfile; $fname =~ s|^.*/||; $boundary = "==AshiatoLOG+$ctm=="; $replyaddr = 'AshiatoLog' unless ($replyaddr); open(MAIL,"| $sendmail -t -oi $mailaddr") or die "$!"; print MAIL "X-Mailer: AshiatoLOG Ver.2.01 (c)Funakichi\n"; print MAIL "From: $replyaddr\n"; print MAIL "Reply-To: $replyaddr\n"; print MAIL <<"_EOL_"; MIME-Version: 1.0 To: $mailaddr Subject: $subject Content-Type: multipart/mixed; boundary="$boundary" This is a multi-part message in MIME format. --$boundary Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit $mailinfo --$boundary Content-Type: application/x-unknown-content-type-Excel.CSV; name="$fname" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="$fname" _EOL_ open(FILE, $logfile) or die "$!"; while (read(FILE, $buf, 60*57)) { print MAIL encode_base64($buf); } close(FILE); print MAIL "--$boundary--\n"; close(MAIL); } # 古いデータファイル自動削除! if ($deldate) { my (@dellist, @filelist); opendir(WDIR, $wrdir); @filelist = readdir(WDIR); closedir(WDIR); $_ = $acclog->makFileName($^T - $deldate*86400); m|^[^\d]*(\d+)\.csv$|; $logfile = $1; foreach (@filelist) { next unless (/^$wrfile(\d+)\.csv$/); next if ($1 > $logfile); $_ = $wrdir.$_; push(@dellist, $_); } unlink @dellist if (@dellist); } 1;