#!/usr/bin/perl -w # can't use -T because I use the rename function :( use CGI qw/param textarea textfield header submit start_form end_form/; #use CGI::Carp; use strict; #use diagnostics; print header; my $name = param('name'); my $said = param('talk'); my $file = 'tagbox';my $ext ='.txt'; my $full = $file.$ext; if($name && $said){ if(defined($name && $said)){ $said =~ s/`/\'/g; $name =~ s/`/\'/g; open TAG,">>$full" || errorHTML("Couldn't open the file because $!"); print TAG $name,"`",$said,"\n"; close(TAG) || errorHTML("Shiznit"); } } my (@array, @array2,); if( -e $full){ open TAG2,"<$full" || errorHTML("Damn it!"); @array = ; close(TAG2) || errorHTML("Fsck!"); } if(@array){ #make sure there are some posts... foreach(@array){ my ($name,$said) = split/`/; push @array2,"$name - $said"; } if($#array2 > 24){ for my $i(1..100){ my $file2 = $file.$i; my $file3 = $file2.$ext; if(-e $file3){ next; }else{ rename($full,$file3); } } } $ENV{SCRIPT_NAME} =~ s/.*\/(.*\.(pl|cgi))/$1/i; # greediness can be good, occasionally print start_form(-action=>"$ENV{SCRIPT_NAME}"); print qq!\n
); print "Name:\n",textfield(-name=>'name',-value=>$name,-maxlength=>10,-style=>'font-size:8pt'),"
\n\n"; print "Shit:   \n","\n\n"; print submit(-name=>'',-value=>'Tag the thing'); print end_form; }else{ print "There are no posts. Make one yourself."; print "

\n\n"; print start_form(-action=>"$ENV{SCRIPT_NAME}"); print "Name:\n",textfield(-name=>'name',-value=>$name,-maxlength=>10,-style=>'font-size:8pt'),"
\n\n"; print "Shit:   \n","\n\n"; print submit(-name=>'',-value=>'Tag the thing'); print end_form; } sub errorHTML{print "

Error!

\n
\n
\n@_";}