netro -
Joined: 09 Aug 2003 Posts: 8
|
Posted: Thu Aug 21, 2003 1:24 am Post subject: why? |
|
|
hi i use this:#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);
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;
$value =~ s/\n/ /g; # replace newlines with spaces
$value =~ s/\r//g; # remove hard returns
$value =~ s/\cM//g; # delete ^M's
$FORM{$name} = $value;
}
open(OUTF,">>c:/survey.out") or dienice("Couldn't open survey.out for writing: $!");
# This locks the file so no other CGI can write to it at the
# same time...
flock(OUTF,2);
# Reset the file pointer to the end of the file, in case
# someone wrote to it while we waited for the lock...
seek(OUTF,0,2);
print OUTF "$FORM{'name'}|$FORM{'email'}|";
print OUTF "$FORM{'howreach'}|$FORM{'rating'}|";
%boxes = ( "des" => "Website Design",
"svr" => "Web Server Administration",
"com" => "Electronic Commerce",
"mkt" => "Web Marketing/Advertising",
"edu" => "Web-Related Education" );
foreach $key (keys %boxes) {
if ($FORM{$key} == 1) {
print OUTF "$key,";
}
}
print OUTF "|$FORM{'comments'}\n";
close(OUTF);
print <<EndHTML;
<html><head><title>Thank You</title></head>
<body>
<h2>Thank You!</h2>
Thank you for your feedback.<p>
<a href="index.html">Return to our home page</a><p>
</body></html>
EndHTML
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}
and get this:
Content-type: text/html
Software error:
flock() unimplemented on this platform at survey.cgi line 21.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
why wont it work? |
|