½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > Ä¿¹Â´ÏƼ > Áú¹®°ú´äº¯ »ó¼¼º¸±â
Ä¿¹Â´ÏƼ ±¸Àα¸Á÷
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
javascript
PHP
ASP
CSS
mysql
html
jquery
������
image
mobile
API
slide
°Ô½ÃÆÇ
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
°Ô½ÃÆÇŸÀÌƲ Áú¹®°ú´äº¯ / »ó¼¼º¸±â
Æ®À§ÅÍ·Î º¸³»±â
Ãßõ¼ö 96 | Á¶È¸¼ö 3,183 | µî·ÏÀÏ 2003-12-08 16:32:30

´Ð³×ÀÓ

HappyCGI

À̸ÞÀÏ

webmaster@happycgi.com

Á¦¸ñ

[´äº¯] Perl·Î °Ô½ÃÆÇ ¸¸µé±âÁß.. GEtÀ¸·Î ³Ñ¾î¿Â µ¥ÀÌÅÍ
³»¿ë
[sunny97´Ô ¿øº»±Û]

¾È³çÇϼ¼¿ä 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&nbsp;&nbsp;&nbsp;Á¶È¸¼ö;<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/&/&amp;/g;
                $$r =~ s/>/&gt;/g;
                $$r =~ s/</&lt;/g;
                $$r =~ s/\"/&quot;/g;
        }


        ($title, $name, $email, $message, $uptime, $rcount);
}

 

 

ÇØÇÇCGI ÀÔ´Ï´Ù.

http://forum.happycgi.com/board_detail.cgi?db=gold_tip&number=83&g_number=9889&c_number=1000&page=1

¸¦ ÀÌ¿ëÇÏ½Ã¸é ½±°Ô µÉ°Í °°±¸¿ä.



$work = $ENV{"QUERY_STRING"};
@pairs_end = split(/&/, $work);
foreach $pair (@pairs_end) {
   ($kname, $value) = split(/=/, $pair);
   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
   $END{$kname} = $value;
 }

 

ÀÌ·± ½ÄÀ¸·Î ¹Þ¾Æ¼­


$END{'msg_id'} ·Î °ªÀ» ¹ÞÀ¸½Ã¸é µË´Ï´Ù.

ÁÁÀº ÇÏ·çµÇ¼¼¿ä.


Ãßõ½ºÅ©·¦¼Ò½ºº¸±â ¸ñ·Ï
ÀÌÀü°Ô½Ã±Û Perl·Î °Ô½ÃÆÇ ¸¸µé±âÁß.. GEtÀ¸·Î ³Ñ¾î¿Â µ¥ÀÌÅÍ 2003-12-08 15:58:13
´ÙÀ½°Ô½Ã±Û ÀÇ·Ú°ü·ÃÁú¹®ÀÔ´Ï´Ù. 2003-12-08 18:21:25