성빈 보거라.

성명  
   achor ( Vote: 97 )
홈페이지      http://i.am/achor
분류      제안

#!/usr/local/bin/perl

# 우리가 쓰고 있는 방명록이다.

# 부디 열심히 분석하여 빛이 될 수 있기를... 훌쩍. !_!

# 무단도용하면 두금이야. --;



# 일단 기본 변수 선언를 선언한다.

$LogFile = 'bbs.txt';

$max = 100;

$slip = "\x01";

$newline = "\x03";



%form = &init;

$name = $form{ 'name' };

$message = $form{ 'message' };

$url = $form{ 'url' };

$email = $form{ 'email' };

$command = $form{ 'command' };

$args = $form{ 'args' };



print "Content-type: text/plain\n\n";



# flash에서 wite 키를 누르면 이쪽이 실행된다. flash에서 command에 wite 값을 주어서 이쪽으로 보낸다.

if( $command eq 'write' )

{

if( $name eq '' || $message eq '' )

{

&view( 1 );

}



open( Log, "<$LogFile" );

@lines = <Log>;

close( Log );



# 새로운 데이터 추가하고,



$str = "$name$slip$message$slip$url$slip$email";

$str =~ s/\r\n/$newline/g;

$str =~ s/\n\r/$newline/g;

$str =~ s/\n/$newline/g;

$str =~ s/\r/$newline/g;

$str .= "\n";



push( @new, $str );



$i = 0;

foreach $line ( @lines )

{

$i++;

if ( $i == $max ) { last; }

push( @new, $line );

}



# 로그 파일에 변수 저장하고,

open( Log, ">$LogFile" );

print Log @new;

close( Log );



print "name=$name&message=$message&url=$url&email=$email&command=end";

exit;

}



# 로그 파일의 라인 최대값 변수에 입력하고.

if( $command eq 'max' )

{

open( Log, "<$LogFile" );

@lines = <Log>;

close( Log );



$i = 0;

foreach $line ( @lines )

{

$i++;

}



print "max=$i&command=end";

exit;

}





&view( $args );



# 기본 함수 설정하는 부분이다. --+

sub init

{

local ($buffer, @pairs, $pair, $name, $value, %FORM);



$ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;

if ( $ENV{'REQUEST_METHOD'} eq "POST" )

{

read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );

}

else

{

$buffer = $ENV{'QUERY_STRING'};

}

@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;

$FORM{$name} = $value;

}

%FORM;

}



# 자, 여기가 중요해. flash에 변수를 전달하는 부분이야. 잘 보거라. --+

sub view

{

$mnum = $_[0];



open( Log, "<$LogFile" );

@lines = <Log>;

close( Log );



@lines = reverse( @lines );

$i = 0;

foreach $line ( @lines )

{

$i++;

if( $i == $mnum )

{

( $name, $message, $url, $email ) = split( /$slip/, $line );

$message =~ s/$newline/\n/g;

print "name=$name&message=$message&url=$url&email=$email";

last;

}

}

print "&command=end";

exit;

}



exit;



# 됐냐? 열심히 연구해 보고 수 시간 내에 응답 바란다.

# 다시금 말하지만 정말 별 거 없다.

# 여기처럼 command값이 정해지면 그쪽으로 이동시켜서 실행시키면 되고,

# flash로 값 보내는 것도 여기처럼 하면 된다.

# 행운을 빈다. !_!

#

# - achor Webs. achor

본문 내용은 9,094일 전의 글로 현재의 관점과 다를 수 있습니다.

Post: https://achor.net/board/freeboard/1518
Trackback: https://achor.net/tb/freeboard/1518

카카오톡 공유 보내기 버튼 LINE it! 밴드공유 Naver Blog Share Button
Please log in first to leave a comment.


Tag


 4388   220   170
No
분류
파일
제목
성명
작성일
1008     성대의 전설적인 존재.. 아처 [8] venik 2002/05/07
1007제안    성빈 보거라. achor 2000/04/11
1006잡담    성숙한 사랑에 관하여.. 민수 2000/01/25
1005답변      세 가지의 재미 없는 이야기 [1] achor 2002/01/09
1004 Download: 84, Filesize:    세 번째 배너입니다. ^^ 김신갑 2000/05/13
1003     세기의 발명품 venik 2000/10/13
1002     세미나준비 마지막입니다.. 부탁합니다.. 고정원 2000/11/22
1001     세상에.. [1] 하바내라 2009/05/28
1000     세상은 참 좁더군요 [3] 장어 2002/03/20
999     세상이 아름답게 느껴질 때 민물장어 2001/01/03
998 Download: 297, Filesize:    섹시 아처 [2] 2003/06/07
997영상    섹시 한 모금 achor 2000/12/27
996     섹시한 꿉지가. [4] ggoob 2002/10/18
995잡담    섹시한 남자가 되기 위하여... achor 2000/05/09
994잡담    소림족구 achor 2002/01/05
993 Download: 110, Filesize:    소멸 applefile 2000/08/08
992잡담    소설을 읽으며... achor 2000/09/06
991관리    소셜 로그인 [1] achor 2016/09/11
990 lock   소풍때 아이들과 함께 sakima 2001/05/20
989질문    소호서버 구축에 관하여... ^^ 고정원 2000/11/04
    166  167  168  169  170  171  172  173  174  175     

  당신의 추억

ID  

  그날의 추억

Date  

First Written: 11/06/1999 04:17:00
Last Modified: 03/04/2025 08:37:36