#!/usr/local/bin/perl # 標準入力のリダイレクション ./cmd $lt;file require '/home/funa/mimer.pl'; @i=`/bin/cat -`; $fp = 0; $fu = 0; $webh = 'http://ftvjapan.ddo.jp/~funa'; $homed = '/home/funa'; $datad = "$homed/public_html/sha/s-data"; $web = "$webh/sha/s-data"; $newd = "$homed/public_html/sha/s-new"; $userd = "$homed/sha/s-user"; foreach $line (@i) { if (index( $line ,"USER:") ne -1) { $muser = $line; $muser =~ s/USER://; $muser =~ s/\n//; $fu = 1; } if (index( $line ,"PASS:") ne -1) { $mpass = $line; $mpass =~ s/PASS://; $mpass =~ s/\n//; $fp = 1; # print "GET PASS: $mpass\n"; } } $file = "$userd/$muser"; if (!open(NOTE,"$file")) { $fu = 0 ; } @DATA = ; close(NOTE); foreach $line (@DATA) { ($MAIL,$ID,$PASS,$HP) = split(/\,/,$line); $HP =~ s/\n//g; } if ($mpass ne $PASS) { $fp = 0; # print "PASSWD is BAD\n"; } if (($fp eq 0 )||($fu eq 0)) { $mailprog = '/usr/sbin/sendmail'; # mail system $admin = 'funa@cc.seikei.ac.jp'; open (MAIL, "|$mailprog $admin") || &error("mail program error"); print MAIL "Subject: SHA-MAIL err\n\n"; print MAIL "-------------------------------------------------------\n"; print MAIL @i; print MAIL "-------------------------------------------------------\n"; close (MAIL); exit; } # print "START\n"; $tit = "NO TITLE"; foreach $line (@i) { if (index( $line ,"Subject: ") ne -1) { $tmp = $line; $tmp =~ s/Subject: //; $tit = &mimedecode($tmp, "JIS"); $tit =~ s/\n//; } } $ft = 0; $fi = 0; $html = "
\n";
   $html .= "TITLE: 
$tit\n"; foreach $line (@i) { if (index( $line ,"---abcdefg") ne -1) { $ft = $ft + 1; next; } if ((index( $line ,"PASS:") ne -1)||(index( $line ,"USER:") ne -1)) { next; } if ($ft eq 1 ) { if (index( $line ,"Content-T") ) { $html .= $line; } } if ($ft eq 2 ) { if ($fi eq 0 ) { $img = "Content-type: image/jpeg\n\n"; $fi = 1; $imgs = ""; next; } if (index( $line ,"Content-T")ne -1 ) { next; } $imgs .= $line; } } # print "BODY is $html\n"; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = $year + 1900; $mon = $mon + 1; $ID = sprintf("%04d%02d%02d%02d%02d%02d",$year,$mon,$mday,$hour,$min,$sec); $html .= "$year-$mon-$mday
"; $html .= "$hour:$min:$sec\n"; $html .= "pic(JPG)
"; $html .= "pic(GIF)
"; $html .= "pic(PNG)
"; $html .= "pic(sPNG)
"; $html .= "KOKOMAIL
"; $html .= "
"; $html .= "DEL
"; $html .= "TUHOU
"; $html .= "
"; # $ID = "$year$mon$mday$hour$min$sec"; # $c = $c + 1; #open (IMG , ">$homed/public_html/sha/s-data/$muser/img/$ID.jpg")|| print "JPEG open error\n $homed/public_html/sha/s-data/$muser/img/$ID.jpg\n"; open (IMG , ">$homed/public_html/sha/s-data/$muser/img/$ID.jpg"); binmode IMG; print IMG &bodydecode($imgs,"b64"); print IMG &bdeflush("b64"); close (IMG); open (IMG , ">$homed/public_html/sha/s-data/$muser/$ID.html"); print IMG $html; close (IMG); chmod (0644,"$homed/public_html/sha/s-data/$muser/$ID.html"); chmod (0644,"$homed/public_html/sha/s-data/$muser/img/$ID.jpg"); #update $html = "
\n";
   $html .= "TITLE:$tit\n";
   $html .= "DATE:$mon-$mday/$hour:$min\n";
   $html .= "USER:$muser\n";
   $html .= "
\n"; open (IMG , ">$newd/$muser.html"); print IMG $html; close (IMG); chmod (0644,"$newd/$muser.html"); exit; @i=`/usr/bin/convert -colors 16 -geometory 96x96! $homed/public_html/sha/s-data/$muser/img/$ID.jpg $homed/public_html/sha/s-data/$muser/img/$ID.gif`; chmod (0644,"$homed/public_html/sha/s-data/$muser/img/$ID.gif"); @i=`/usr/bin/convert -colors 16 -geometory 96x96! $homed/public_html/sha/s-data/$muser/img/$ID.jpg $homed/public_html/sha/s-data/$muser/img/$ID.png`; chmod (0644,"$homed/public_html/sha/s-data/$muser/img/$ID.png"); @i=`/usr/bin/convert -colors 256 -geometory 50x50! $homed/public_html/sha/s-data/$muser/img/$ID.jpg $homed/public_html/sha/s-data/$muser/img/s$ID.png`; chmod (0644,"$homed/public_html/sha/s-data/$muser/img/s$ID.png");