#! /usr/local/bin/perl # authorization require 'jcode.pl'; # # 初期設定 # $an1_file = "/home/user/bin/.vip"; $htpasswd2 = "/home/user/bin/htpasswd2"; $sendmail = "/usr/lib/sendmail"; $yourmail = 'your@mail.host'; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } print "Content-type: text/html\n\n"; if ($buffer eq "") { &html_form; &html_trailer1; } else { &an_w; &html_trailer2; } sub w2_html { print "
\n"; print "\n"; exit; } sub html_trailer2 { #発行 open(OUT,"| $sendmail $email") || die "error!\n"; print OUT "From: $yourmail\n"; print OUT "To: $email\n"; print OUT "Subject: information\n\n"; print OUT "\n"; print OUT "username : $email\n"; print OUT "password : $passwd\n\n"; print OUT "by $yourmail\n"; close(OUT); print "
\n"; print "\n"; } sub html_form { print "
\n";
}
sub an_w {
@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;
$value =~ s/</g;
$value =~ s/>/>/g;
$value =~ s/"/"/g;
$FORM{$name} = $value;
}
$email = $FORM{'email'};
$email =~ s/\n//g;
$email =~ s/\r//g;
$email =~ s/ / /g;
if ($email eq "") { &w2_html; &html_trailer1; exit; }
if ($email =~ / /) { &w2_html; &html_trailer1; exit; }
if (!($email =~ /(.*)\@(.*)\.(.*)/)) { &w2_html; &html_trailer1; exit; }
open(DB,"$an1_file") || die "Cannot Open Log File $log_file: $!";
@lines =