#!/usr/local/bin/perl ############################## #Post article of information # # by Matthew Manela # ############################## require 'subparseform.lib'; # sub parsing $basedir = "/data1/blah.net/blah/"; $baseurl = "http://blah.blah.net"; &Parse_Form; print "Content-type: text/html\n\n"; $tpass=$formdata{password}; $article=$formdata{text}; $destination=$formdata{destination}; #the source of the file to write to @info=split(/\n/,$article); # set $file to location of txt file $file="$basedir$destination\.txt"; # make sure destination is within parameters if($destination=~/^([a-zA-Z])+$/){ &main; }else{ &filename; } sub main{ if(-e $file){ open(WRITE, ">$file")|| &filename; foreach $line (@info){ print WRITE "$line\n"; } close(WRITE); }else{ &filename; } sub filename{ print"You can't write to that file!\n"; exit; } #### #!/usr/local/bin/perl # Get article form link and display # by Matthew Manela require 'subparseform.lib'; # sub parsing $basedir = "/data1/blah.net/blahs/"; $baseurl = "http://blah.blah.net"; &Parse_Form; print "Content-type: text/html\n\n"; $article=$formdata{'article'}; $page=$formdata{'page'}; $maxlength=43; $next=$page+1; $previous=$page-1; $start=($page-1)*$maxlength; $finish=$page*$maxlength; &main; sub main{ $file="$basedir$article\.txt"; open(TOP, "$basedir/top\.htm")|| &filename; @top=; close(TOP); open(BOTTOM, "$basedir/bottom\.htm")|| &filename; @bottom=; close(BOTTOM); open(READ, "$file")|| &filename; my @info = grep { !/^\s*$/ } ; chomp(@info); close(READ); $length=@info; foreach $part (@top) { if ($part=~/^<\/head>$/){ print"\n"; }else{ print"$part\n"; } } for($i=$start;$i<$finish;$i++){ if ($info[$i]=~ m/  

\n"; }elsif(($length>$finish)&&($page==1)){ print"

Continue to the next page -->  

\n"; } foreach $thing (@bottom){ print"$thing\n"; } } sub filename{ print"Article does not exist\n"; print"Sorry, That article does not exist.
\n"; print""; exit; }