#!/usr/bin/perl
print "Content-type: text/html\n\n";
&ParseForm;
print <<"HTML";
Question Edited!
HTML
use DB_File;
$dbmfile = 'riverweb.dbm';
tie %hash, DB_File, $dbmfile; # open database, to be accessed
$call{'keywords'} =~ s/-/:/g;
$string = (
$call{'pi0'} . "|" .
$call{'pi1'} . "|" .
$call{'pi2'} . "|" .
$call{'pi3'} . "|" .
$call{'keywords'} . "|" .
$call{'pi4'}
);
$id = $call{'pi0'};
#print "$string
";
#print "$hash{$id}
";
print "You have changed
$hash{$id}
";
$hash{$id} = $string;
print "To
$hash{$id}
";
print <<"HTML";
HTML
untie %hash;
sub ParseForm {
# Read in form input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
# loop through array and do this..
foreach $pair (@pairs) {
# assign variables to the name and respective values
($nome, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
# Translate Plus Signs into a space Character
$value =~ tr/+/ /;
# Find Hexadecimal #'s (%[][]) then convert it to what it should be
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Allows you to hit enter in the text field
$value =~ s/\n//g;
# We're using this one.
$value =~ s/://g;
$value =~ s/&//g;
# freaky tab character....
$value =~ s/
/ /g;
# youre not gettin' in here secret agent man... (Prevent Hackers or DIE)
if ($value =~ m///g;
# put the info in an associative array
$call{$nome} = $value;
# end foreach
}
}