#!/usr/bin/perl
require 'parse.pl';
&parse_form;
print "Content-type:text/html\n\n";
&checklength;
print'<body>';
if ($v{'email'} =~ /.*\@.*\..*/) {
if (!$v{'subj'}) { &breakerror('ไม่ได้กรอกหัวเรื่อง'); }
} else {
&breakerror('ไม่ได้กรอก E-Mail หรือกรอกผิดพลาด');
}
$filename="number.dat";
open(myfile,"$filename");
@rm = <myfile>;
close(myfile);
if (!@rm) {
$number=1000000001999;
} else {
$number=substr($rm[0],0,10);
$number=$number+1;
$number=join '',$number,'999';
}
open(myfile,">$filename");
print myfile $number;
close(myfile);
$title = join ':',$number,$v{'subj'},$v{'email'},$v{'icq'},$v{'answer'},$ENV{REMOTE_ADDR};
$filename = join '.',$number,'txt';
open(myfile,">$filename");
print myfile "$title\n";
print myfile "$v{'message'}";
close(myfile);
print "$title<br>Add new message : OK";
# mail process
$mailprog = '/var/qmail/bin/qmail-inject';
open (MAIL, "|$mailprog") || die "Can't open $mailprog!\n";
print MAIL "To: $v{'email'},$ars[2]\n";
print MAIL "From: perlphpasp\@thaiabc.com \n";
print MAIL "Subject: You use this email add the content to board\n\n";
print MAIL "Just Inform from http://perlphpaspbook.hypermart.net\n ";
print MAIL "You will get the message if someone reply your content.\n";
print MAIL "If you are not ok, you can delete the content by yourself.\n";
print MAIL "$v{'message'}\n";
close (MAIL);
จำนวน : 43 บรรทัด