################################################################# # Open the database to write data, changing the neccesary lines # ################################################################# if ($input{'action'} eq 'add'){ open (DATABASE1,">>$database"); print DATABASE1 "$input{'ncompany_name'}|$input{'nstreet'}|$input{'ncity_st_zip'}|$input{'nphone'}|$input{'nfax'}|$input{'nwebsite'}|$input{'nemail'}|$input{'ncategory'}|$input{'nstorefront'}|$input{'nlogo'}|$input{'nalpha'}|$input{'nfirst_name'}\n"; close (DATABASE1); } ################################################################# # Open the database to write data, changing the neccesary lines # ################################################################# if ($input{'action'} eq 'delete'){ open (DATABASE,">$database"); @DB=; foreach $rec (@ODB){ chomp($rec); ($company_name,$street,$city_st_zip,$phone,$fax,$website,$email,$category,$storefront,$logo,$alpha,$first_name)=split(/\|/,$rec); if ($company_name eq $input{'company_name'} && $street eq $input{'street'} && $city_st_zip eq $input{'city_st_zip'} && $phone eq $input{'phone'} && $fax eq $input{'fax'} && $website eq $input{'website'} && $email eq $input{'email'} && $category eq $input{'category'} && $storefront eq $input{'storefront'} && $logo eq $input{'logo'} && $alpha eq $input{'alpha'} && $first_name eq $input{'first_name'} ){ print DATABASE ""; }else{ print DATABASE "$company_name|$street|$city_st_zip|$phone|$fax|$website|$email|$category|$storefront|$logo|$alpha|$first_name\n"; } } close (DATABASE); } ######################################## print "Location: $databaseview\n\n"; ######################################## # Code to get the data from GET & POST # ######################################## sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $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; $input{$name} = $value; } }