
gus
Deleted
Mar 2, 2000, 7:20 AM
Post #1 of 4
(1729 views)
|
Insecure Dependency?!
|
Can't Post
|
|
Hi, I've started to lern perl and I'm trying to write a *very* simple guestbook http://onlinelogbook.tripod.com/form.html but when I try and submit a message I get the error: "Insecure dependency in open while running with -T switch at ./form.pl line 20." Line 20 is where I have: open (WRITE, ">messages/$number"); Messages are stored in files within the "messages" directory, numbered sequentially. The number of messages stored is held in "messageno.dat". When a submission is made the script reads in messageno.dat and assigns the value to $number. It then increments $number and tries to execute line 20, opening a new file to put the form fields in. Simple, eh? So why the error? There are two more scripts (readmail.pl and readmail2.pl) which work fine. Any help would be much appretiated, Gus # full code for form.pl #!/usr/local/bin/perl # open file to see how many messages there are open( FILEIN, "<messages/messageno.dat" ); # put contents of file (i.e. number) into variable $number = <FILEIN>; # don't need the file anymore close( FILEIN ); # increment the variable $number = $number + 1; # open the dat file, this time for writing open( FILEOUT, ">messages/messageno.dat" ); # put the new number of messages back in the dat file print FILEOUT "$number"; # don't need it anymore close( FILEOUT ); # open a new file to write to open( WRITE, ">messages/$number" ); # get arguments $Query_String = $ENV{'QUERY_STRING'}; # use "&" to split args into an array @NameValuePairs = split (/&/,$Query_String); print "Content-type: text/html\n\n"; print "<html><head><title>Form Response</title></head><body>\n"; print "<center>"; print "<br>"; print "<h1>You have entered:</h1>\n"; # step through array foreach $NameValue (@NameValuePairs) { # split each element ($Name, $Value) = split (/=/,$NameValue); # change "+" back to a space $Value =~ tr/+/ /; # change a new line for a <br> $Value =~ s/%0D%0A/<br>/g; # put all the reserved characters back to normal $Value =~ s/%([\da-fA-F][\da-fA-F])/ pack ("C", hex ($1))/eg; print "<h3>$Name...</h3>$Value<br>\n"; $Value =~ s/<br>/\n/g; # output to file print WRITE "$Name...\n"; print WRITE "----------\n"; print WRITE "$Value\n\n"; } # done with this close( WRITE ); print "<br>"; print "<h2>...thank you</h2>"; print '<a href="http://onlinelogbook.tripod.com/form.html">BACK</a>'; print "</center>"; print "</body></html>";
|