#! /usr/local/bin/perl ########################################## #BooNetTalk,v1.92 / this program is free.# #bnth.cgi (C) BooBooClub 1997-2005 # ########################################## #set_data $writefc = "./write.cgi"; $talkfc = "./talk.cgi"; $dat = "./ntd.dat"; $max = "12"; $title = 'BooNetTalk'; $frameh = '75%'; #read lib require 'jcode.pl'; #lock check &lock; sub lock{ $lockfile = "./lock/lockfile"; $retry = 1; until (symlink("$dat", "$lockfile")){ if (++$retry >= 7){ unlink("$lockfile"); exit(0); } sleep(1); } } #time $ENV{'TZ'}='JST-9'; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year = ($year + 1900); $mon++; if ($sec < 10) { $sec = "0$sec";} if ($min < 10) { $min = "0$min";} if ($hour < 10){ $hour = "0$hour";} if ($mon < 10) { $mon = "0$mon";} if ($mday < 10){ $mday = "0$mday";} $time = "$year/$mon/$mday $hour:$min:$sec"; #read 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; $value =~ s/\r\n|[\r\n]//ig; $value =~ s/\,//g; $value =~ s//>/ig; &jcode'convert(*value,'sjis'); $FORM{$name} = $value; } #allow if($FORM{'txt'} eq "" || $FORM{'name'} eq ""){ &html; } open (DAT,"$dat"); @dats = ; close (DAT); &write; &html; sub write{ $wrt = "$FORM{'name'}\,$time\,$FORM{'txt'}\n"; unshift (@dats,$wrt); $max--; @dats = @dats[0..$max]; open (DAT,">$dat"); print DAT @dats; close (DAT); } sub html { print "Content-type: text/html\n"; print "Pragma: no-cache\n\n"; print '',"\n"; print '',"\n"; print "$title","\n"; print '',"\n"; print '',"\n"; if($FORM{'submit'}){ print '',"\n"; } else{ print '',"\n"; } print '',"\n"; print '',"\n"; print '',"\n"; unlink("$lockfile"); exit 0; }