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

´Ð³×ÀÓ

HappyCGI

À̸ÞÀÏ

webmaster@happycgi.com

Á¦¸ñ

[´äº¯] cgi Á¦ÀÛ °ü·Ã Áú¹®ÀÌ¿ä
³»¿ë
[tall´Ô ¿øº»±Û]

cgi Á¦ÀÛ °ü·Ã Áú¹® µå¸³´Ï´Ù.


Áú¹®³»¿ëÀº  ÆÄÀÏ Ã·ºÎ ¿¡ ÀÖ½À´Ï´Ù.


À̸æÀÏ·Î ´äº¯ ºÎŹ µå¸±°Ô¿ä ^^;;

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

1¹øÀº °£´ÜÇؼ­ ±×³É ¸¸µé¾îºÃ½À´Ï´Ù.


¾Æ·¡ Äڵ带 º¹»çÇؼ­ test.cgi ÆÄÀÏÀ» ¸¸µçÈÄ Æ۹̼ÇÀ» 755·Î Áֽðí

¾÷·ÎµåÇϽÅÈÄ ¾÷·ÎµåÆú´õ¸¦ 777 ·Î Áֽøé ÀÛµ¿ÇÕ´Ï´Ù.


[ÇÁ·Î±×·¥ÄÚµå]

#!/usr/bin/perl


my $buffer;
 
 $time = time;
$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;
 }

 if ($ENV{'REQUEST_METHOD'} eq "POST") {
  binmode STDIN;
  read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 }
 else { $buffer = $ENV{'QUERY_STRING'}; }
 my ($qx_name, $value);
 if ($buffer !~ /\n/) {
  for (split /&/, $buffer) {
   ($qx_name, $value) = split /=/;
   $qx_name =~ y/+/ /; 
   $qx_name =~ s/%(..)/chr hex $1/ge;
   $value =~ y/+/ /; 
   $value =~ s/%(..)/chr hex $1/ge;
   $$qx_name = $value;
  }
 }
 else { # ÆÄÀÏ ¾÷·Îµå
  my ($qx_name, $value);
  my ($border) = ($buffer =~ /^(.+?)\r?\n/);
  $buffer =~ s/${border}--$//;
  my $bad_char = '`~!@#%^&*()|,<>?;:\'"[]{}';

  for (split /$border/, $buffer) {

   next if $_ eq '';
   s/^\r?\n//;

   if (/name="FILE(\d)"; filename="(.+?)"/i) {
 my ($FILE_VAR) = $1;
    next if $2 eq '';
 
 my ($FILE_NAME) = $2 =~ m{([^\\^/]+)$};
 $FILE_NAME =~ s/[$bad_char]//g;
 #ÆÄÀÏÀ̸§ ¹è¿­ÀúÀå
    $FILES{'file'}->{name} = $FILE_NAME;
    s/^.+?\r?\n\r?\n//s;
    s/\r?\n$//s;
  if($_ eq '') {
   $FILES{'file'}->{name} = '';
   next;
  }
  else {

  }
  #ÆÄÀϳ»¿ë ¹è¿­ÀúÀå
  #$FILES{'file'}->{data} = $_;
     my ($File_Name_In) = "FILE" . "$FILE_VAR";
  $Field{$File_Name_In} = $FILE_NAME;

  }
 
  else {
   s/^.+?name\=\"(\S+?)\"\r?\n\r?\n(.+?)\r?\n$//s;
   ($qx_name = $1) =~ tr/\r//d;
   ($value = $2) =~ tr/\r//d;
   $$qx_name = $value;
  }
 } #for
}#else

 

 

#############################################################################
if ($END{'action'} eq "") {
 &add;
}
elsif ($END{'action'} eq "add_reg") {
 &add_reg;
}

#############################################################################
sub add {
print "content-type:text/html\n\n";


 #ÆÄÀÏÀ» ¿­¾î¼­ ÀоÀÚ. ±»ÀÌ ¾Æ·¡ ¹æ¹ýÀ» ¾²Áö ¾Ê¾Æµµ µÇÁö¸¸ È®À强À» À§Çؼ­
 #¾Æ·¡ ó·³ »ç¿ëÇÑ´Ù.
 open (SR,"data.txt");
 while (<SR>) {
 $view_read .= $_;
 }
 close SR;

print qq~

<html>
<form action=test.cgi?action=add_reg method=post>
<input type=text name=view value=$view_read>
<input type=submit>
</html>
~;
}

#############################################################################
sub add_reg {
#ÀԷ°ú µ¿½Ã¿¡ ÆÄÀÏÀ» ¾²°í sub add ·Î ´Ù½Ã ³¯·ÁÁØ´Ù.
 open (SR,">data.txt");
 print SR "$view";
 close SR;
 &add;
}


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

 

Ãßõ½ºÅ©·¦¼Ò½ºº¸±â ¸ñ·Ï
ÀÌÀü°Ô½Ã±Û ¼¼ÆȺ¸µå¿¡¼­... 2003-10-28 10:35:27
´ÙÀ½°Ô½Ã±Û À¥»ó CGI·Î ¸®´ª½º°èÁ¤Ãß°¡,»èÁ¦ 2003-10-28 16:03:14