µî·ÏÀÏ 2005-03-29 11:38:33 Á¶È¸¼ö 163
ÀÛ¼ºÀÚ dlgustjd µµ¸ÞÀÎ www.leehyunsung.com/mail/psmail.htm
Á¦¸ñ ¸ÞÀÏ°ü·Ã¹®ÀÇÀÔ´Ï´Ù.
¾È³çÇϼ¼¿ä.
¿ì¶ß³ÝÀÔ´Ï´Ù.

ÀúÈñ ¼­¹ö¿¡¼­ perl·Î µÈ CGI´Â Áö¿øÇÕ´Ï´Ù.
´Ü ¹®¹ý»ó ¹®Á¦°¡ ÀÖ¾î º¸ÀÔ´Ï´Ù.
ÇöÀç ÀúÈñ°¡ ¼Ò½º¸¦ °ËÅäÁßÀÔ´Ï´Ù.

°¨»çÇÕ´Ï´Ù.

> --------------------- :: dlgustjd wrote :: ----------------------- <
bash¾ð¾î·Î µÈ°ÍÀº Áö¿øÀÌ ¾ÈµÈ´Ù°í Çϼż­ ´Ù¸¥°É·Î ±¸Çغôµ¥ ¿©ÀüÈ÷ Internal Server Error ¶ó°í ³ª¿À¸é¼­ µÇÁö¾Ê½À´Ï´Ù. ÁÖ¼Ò´Â www.leehyunsung.com/mail/psmail.htmÀÔ´Ï´Ù. È®ÀκÎŹµå¸³´Ï´Ù.
ÄÚµå´Â Á¦°¡º¸±â¿¡ ¾Æ¹«¹®Á¦¾ø¾îº¸À̴µ¥...Ȥ½Ã ¿ì¶Ñ³Ý¿¡¼­ Áö¿øÇÏÁö ¾Ê´Â°ÍÀÌ ¾²¿´´Ù¸é ¾Ë·ÁÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.


#!/usr/bin/perl

$MailDir = "/usr/sbin/sendmail";

$value[2] = "mail\@leehyunsung.com";

$formmail = "http://www.leehyunsung.com/sms/psmail.htm";

$settitle = "<center>Pansool's Formmail Ver 1.0</center>";



if($ENV{'REQUEST_METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@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;
$INPUT{$name} = $value;
}
if($INPUT{'action'} eq "") { &read; }
if($INPUT{'action'} eq "") { &read; }
elsif($INPUT{'action'} eq "read") { &read; }
elsif($INPUT{'action'} eq "save") { &save; }

sub save {
if ($INPUT{'from'} =~ /.+\@.*\..*/) {
$from = "$INPUT{'from'}";
}
else {
$errorcode = "E-mailÁÖ¼Ò¸¦ ÀÔ·ÂÇÏÁö ¾ÊÀ¸¼Ì´øÁö À߸øµÈ¹æ½ÄÀÌ¿¹¿°.\n";
&error;
exit;
}
if ($INPUT{'toemail'} =~ /.+\@.*\..*/) {
$toemail = "$INPUT{'toemail'}";}
else {
$errorcode = "¹Þ´Â»ç¶÷ÀÇ E-mailÁÖ¼Ò¸¦ ÀÔ·ÂÇÏÁö ¾ÊÀ¸¼Ì´øÁö À߸øµÈ¹æ½ÄÀ̳׿©.\n";
&error;
exit;
}
if ($INPUT{'title'}) {
$title = "$INPUT{'title'}";
$title =~ s/\r\n\r\n/<p>/g;
$title =~ s/\r\n/<br>/g;
}
else {
$errorcode = "Á¦¸ñÀº ¾²¼Å¾ßÁ´~ ¤Ì.¤Ì.\n";
&error;
exit;
}
if ($INPUT{'detail'}) {
$detail = "$INPUT{'detail'}";
}
else {
$errorcode = "³»¿ë¾øÀÌ E-mailÀ» º¸³»½Ã·Á±¸¿µ? ¤Ñ.¤Ì;.\n";
&error;
exit;
}
open(MAIL,"|$MailDir -t $toemail");
print MAIL "To: $toemail\n";
print MAIL "From: $from\n";
print MAIL "Subject: $title\n";
print MAIL "Content-type:text/html\n\n";
$command =~ s/\r\n\r\n/<p>/g;
$command =~ s/\r\n/<br>/g;
print MAIL "<div align=center><table border=0 cellspacing=3 cellpadding=3 width=100%>\n";
print MAIL "<tr>\n";
print MAIL "<td><font style=font-µ¸¿ò;font-size:12pt>$detail</font></td>\n";
print MAIL "</tr>\n";
print MAIL "</table></div>\n";
close(MAIL);
&sethtml;
print "<body>\n";
print "<center>\n";
print "<td align=center><br><br><span style=font-size:14pt;color:#E2FAFA;Filter:glow(color=#0000ff,strength:1);width:80%;height:20;>¸ÞÀÏÀ» º¸³Â½À´Ï´Ù..^-^*.</span><td>\n";
print "\n";
print "<td align=center><br><br><font size=2><a href=$formmail><b>E-mail¾²±â</b></a></font><br><br><INPUT TYPE=BUTTON VALUE='⠴ݱâ' onClick='parent.window.close()'>\n";
print "</center>\n";
print "\n";
print "</body>\n";
print "</html>\n";
}


sub sethtml {
print "Content-Type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<title>Pansool's Formmail Ver1.0</title>\n";
print "<style type=text/css>\n";
print "A:link {text-decoration:none}\n";
print "A:visited {text-decoration:none}\n";
print "td,form,select,input,textarea {font-family:µ¸¿ò;font-size:9pt}\n";
print "</style>\n";
print "</head>\n";
}


sub error {
&sethtml;
print "<body text=$setfontcolor>\n";
print "<div align=center><table bgcolor=e7fafa border=0 cellspacing=0 cellpadding=0 width=100% height=60%>\n";
print "<tr>\n";
print "<td align=center><font style=font-size:20pt;font-weight:bold;color:#990033>¾î¼³ª.. ¤Ð.¤Ð</font><br><br><font style=font-size:10pt;color:#305eaa>$errorcode</font><br><br><br><a href='javascript:history.back()'><font size=2><b><-µ¹¾Æ°¡±â^^></b></a></td>\n";
print "</tr>\n";
print "</table></div>\n";
print "</body>\n";
print "</html>\n";
}