¾È³çÇϼ¼¿ä Perl·Î °Ô½ÃÆÇÀ» Â¥°í Àִµ¥ ±Ã±ÝÇÑ°ÍÀÌ ÀÖ½À´Ï´Ù.
²À Á» µµ¿ÍÁÖ¼¼¿ä
´Ù¸§ÀÌ ¾Æ´Ï¿À¶ó,
¸¸¾à get¹æ½ÄÀ¸·Î id°¡ ³Ñ¾î¿Â´Ù¸é
/view.cgi?msg_id=$msg_id
ÀÌ·±½ÄÀ¸·Î¿ä.. ±×·³ $msg_id¸¦ ¾²·Á¸é ¾î¶»°Ô ¼³Á¤ ÇØÁà¾ß Çϳª¿ä?
CGI.pm¸ðµâÀ» ¾²Áö ¾Ê°í.. ¾²´Â ¹æ¹ýÀ» ã°í ÀÖ½À´Ï´Ù.
¾Æ·¡Ã³·³ ¼³Á¤Çß´õ´Ï.. ¾ÈµÇ´Â°Å °°Àºµ¥¿ä. °í¼ö´Ôµé µµ¿òÀ» Á» ºÎŹµå¸³´Ï´Ù.
my $msg_id =$in{'msg_id'};
ÀÌ·¸°ÔÇϸé url¿¡ ³Ñ¾î¿À´Â º¯¼ö¸¦ ¹ÞÀ»¼ö Àִ°Š¾Æ´Ñ°¡¿ä> -_-;;;;;;
my $input;
my $method = $ENV{'REQUEST_METHOD'};
if ($method eq 'POST')
{
binmode(STDIN);
read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
}
else
{
$input = $ENV{'QUERY_STRING'};
}
my $pair;
my($key, $val, %in);
foreach $pair (split /&/, $input) {
$pair =~s/\+/ /g;
($key, $val) = split(/=/, $pair, 2);
$key =~ s/%(..)/pack("H2",$1)/ge;
$val =~ s/%(..)/pack("H2",$1)/ge;
$in{$key} =$val;
}
my $msg_id =$in{'msg_id'};
¾Æ·¡Ã³·³ ¸®½ºÆ®Áß Å¬¸¯ÈÄ ³»¿ëÀ» º¸·Á µé¾î°¡¸é.. Çϳªµµ µ¥ÀÌÅ͵éÀÌ Çϳªµµ ¾È³ª¿Í¿ä -_-;
my ( $title, $name, $email, $message, $uptime, $rcount) = getMessage($dbh, $msg_id);
$rcount ++;
my $sql = "update bbs set count=count+1 where msg_id='$msg_id'";
my $sth = $dbh->prepare($sql) or die print "DBI::errstr\n";
$sth->execute if $sth;
$dbh->disconnect;
my $tbl;
$tbl .=qq!<tr><td>$FF<h3>$title</h3>$FA</td></tr><tr bgcolor="#ffffef"><td>$FF$message$FA</td></tr><tr><td border="right">!;
$tbl .=qq!<table border="0"><tr><td>$FF¿Ã¸°ÀÌ$FA</td><td>$FF$name<a href="mailto:$email">$email</a>$FA</td></tr><tr><td>$FF¿Ã¸°½Ã°¢$FA</td><td>$FF:$uptime Á¶È¸¼ö;<font color="green">$rcount</font>$FA</td></tr></table>!;
sub getMessage {
my $sth = $dbh->prepare("select msg_id, title, name, email, message, uptime, count from bbs where msg_id = '$msg_id'");
$sth->execute;
my ($msg_id,$title,$name,$email,$message,$uptime,$rcount) = $sth->fetchrow_array;
$sth -> finish;
my $r;
foreach $r (\$name, \$title, \$message ) {
$$r =~ s/&/&/g;
$$r =~ s/>/>/g;
$$r =~ s/</</g;
$$r =~ s/\"/"/g;
}
($title, $name, $email, $message, $uptime, $rcount);
}