성빈 보거라.

성명  
   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,089일 전의 글로 현재의 관점과 다를 수 있습니다.

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   12
No
분류
파일
제목
성명
작성일
4168     아처.. 그대의 이름은 .. ^^; 민물장어 2000/04/10
4167답변      Re 1: 좋아요. achor 2000/04/10
4166공지    불의의 화재로 인한 접속불가 현상이 있었습니다. achor 2000/04/11
4165공지    신문에 인터뷰 기사가 나온답니다. ^^* achor 2000/04/11
4164제안    성빈 보거라. achor 2000/04/11
4163     ^^ 마르티나 2000/04/11
4162답변      Re 1: ^^ achor 2000/04/11
4161잡담      Re 1: Re: to yahon yahon 2000/04/11
4160     [yahon] to 민물장어 yahon 2000/04/12
4159답변      Re 1: [yahon] to 민물장어 achor 2000/04/12
4158         Re 2: Re: 7113 yahon 2000/04/12
4157       Re 1: [yahon] to 민물장어 민물장어 2000/04/12
4156         Re 2: ^^ 민물장어 2000/04/12
4155답변        Re 2: to yahon achor 2000/04/12
4154     민물장어님께. 이문숙 2000/04/12
4153잡담    삼지구엽차 achor 2000/04/13
4152     * 마르티나 2000/04/13
4151답변      Re 1: * achor 2000/04/13
4150       Re 1: 민물장어님께. 민물장어 2000/04/13
4149     안녕하세요...^^ 미운오리 2000/04/13
    8  9  10  11  12  13  14  15  16  17     

  당신의 추억

ID  

  그날의 추억

Date  

First Written: 11/06/1999 04:17:00
Last Modified: 02/27/2025 09:56:04