#! c:/perl/bin/perl #! /usr/local/bin/perl # # wrjoin.pl # Ver1.02 : 9/14/05 : Deleted jcode.pl # Ver1.01 : 1/22/05 : Modified to not register if name is blank # Ver1.0 : 10/21/02 : Initial Revision $joindir = "../joinlist"; $cgibin = "../cgi-bin"; $datafile = "$joindir/joinlist.dat"; $tmpfile = "$joindir/tmp.$$"; $eventhtml = "$joindir/event.shtml"; open(DAT,"< $datafile"); @allline=; close(DAT); ($finnum,@rest) = split(/,/,$allline[$#allline]); if ($ENV{"REQUEST_METHOD"} eq "GET"){ $data=$ENV{"QUERY_STRING"}; $method = 'GET'; } elsif ($ENV{"REQUEST_METHOD"} eq "POST"){ read(STDIN,$data,$ENV{"CONTENT_LENGTH"}); $method = 'POST' } @tmparry=split(/&/,$data); foreach $string (@tmparry){ ($key,$value)=split(/=/,$string); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s//>/g; if ($value =~ /\r\n/) { $value =~ s/\r\n/
/g; } if ($value =~ /\n/) { $value =~ s/\n/
/g; } if ($value =~ /\r/) { $value =~ s/\r/
/g; } if ($value =~ /,/) { $value =~ s/,/,/g; } $all{"$key"}=$value; } if ($method eq 'POST'){ if ($all{name} ne ''){ open(WR,">> $datafile"); $num = $finnum + 1; print WR "$num,$all{name},,$all{comment}\n"; close(WR); } } else { open(DAT,"< $datafile"); open(WR,"> $tmpfile"); while(){ s/[\r\n]*$//; ($num,$name,$join,$comment)=split(/,/); if($num == $all{num}){ $join = 'off'; } print WR "$num,$name,$join,$comment\n"; } close(DAT); close(WR); rename("$tmpfile","$datafile"); } chmod(0666,"$datafile"); print "Location: $eventhtml\n\n"; exit;