I am NOT a Perl programmer. I have a script that I need to modify and I am pretty clueless. Below I will list the script and maybe someone can help me understand it better. I am a programmer so I understand some of it. The script is an email form script. My client wants me to make the fields NOT be required. Any and all help is appreciated.<br>
<br>
<br>
#!/usr/bin/perl<br>
<br>
require '<A HREF=" TARGET="_new"><br>
$posted=&getformvars(*FORM);<br>
<br>
$mailprog='/usr/sbin/sendmail';<br>
<br>
$instructions_url="<A HREF=" TARGET="_new"><br>
if(!($FORM{'mailto'})) {<br>
&bounce($instructions_url);<br>
exit 0;<br>
}<br>
<br>
#HERE<br>
<br>
if($FORM{'required'}) {<br>
$required=$FORM{'required'};<br>
$required=~ s/\[//g;<br>
$required=~ s/\]//g;<br>
@req=split(/ /, $required);<br>
$counter=0;<br>
while($counter <= $#req) {<br>
if(!($FORM{$req[$counter]})) {<br>
&failure;<br>
}<br>
$counter++;<br>
}<br>
}<br>
<br>
open(MAIL, "¦ $mailprog ".$FORM{'mailto'}) ¦¦ die "Can't open $mailprog!\n";<br>
print MAIL "Reply-to: ".$FORM{'mailto'}."\n";<br>
print MAIL "Errors-to: ".$FORM{'mailto'}."\n";<br>
print MAIL "From: ".$FORM{'mailto'}."\n";<br>
print MAIL "To: ".$FORM{'mailto'}."\n";<br>
if($FORM{'subject'}) {<br>
print MAIL "Subject: ".$FORM{'subject'}."\n";<br>
} else {<br>
print MAIL "Subject: E-Mail Form Results\n";<br>
}<br>
print MAIL "========================================\n\n";<br>
<br>
$counter=1;<br>
while($FORM{'m'.$counter}) {<br>
$theline=$FORM{'m'.$counter};<br>
$theline=~ s/\[([A-Za-z0-9]*)\]/$FORM{$1}/g;<br>
print MAIL $theline."\n";<br>
$counter++;<br>
}<br>
<br>
print MAIL "\n========================================\n";<br>
print MAIL "Entry made from ".$ENV{'REMOTE_ADDR'}."\n";<br>
print MAIL "Referring URL: ".$ENV{'HTTP_REFERER'}."\n";<br>
<br>
close(MAIL);<br>
<br>
&success;<br>
<br>
exit 0;<br>
<br>
sub success {<br>
if($FORM{'success'}) {<br>
&bounce($FORM{'success'});<br>
} else {<br>
print "Content-type: text/html\n\n";<br>
print "<html>\n<body>\n<center><font size=5>Thanks!</font></center>\n</body>\n</html>\n";<br>
}<br>
return;<br>
}<br>
<br>
sub failure {<br>
if($FORM{'failure'}) {<br>
&bounce($FORM{'failure'});<br>
} else {<br>
print "Content-type: text/html\n\n";<br>
print "<html>\n<body>\n<center><font size=5>You didn't enter the required information</font><p><font size=4>Please <a href=\"".$ENV{'HTTP_REFERER'}."\">return</a> to the form.</center>\n</body>\n</html>\n";<br>
}<br>
exit 0;<br>
}<br>
<br>
sub bounce {<br>
local ($url)=@_;<br>
print "Content-type: text/html\n";<br>
print "Location: ".$url."\n\n";<br>
print "<html><body></body></html>\n";<br>
return;<br>
}<br>
<br>
<br>
Thanks to all,<br>
<br>
Brian Yager
<br>
<br>
#!/usr/bin/perl<br>
<br>
require '<A HREF=" TARGET="_new"><br>
$posted=&getformvars(*FORM);<br>
<br>
$mailprog='/usr/sbin/sendmail';<br>
<br>
$instructions_url="<A HREF=" TARGET="_new"><br>
if(!($FORM{'mailto'})) {<br>
&bounce($instructions_url);<br>
exit 0;<br>
}<br>
<br>
#HERE<br>
<br>
if($FORM{'required'}) {<br>
$required=$FORM{'required'};<br>
$required=~ s/\[//g;<br>
$required=~ s/\]//g;<br>
@req=split(/ /, $required);<br>
$counter=0;<br>
while($counter <= $#req) {<br>
if(!($FORM{$req[$counter]})) {<br>
&failure;<br>
}<br>
$counter++;<br>
}<br>
}<br>
<br>
open(MAIL, "¦ $mailprog ".$FORM{'mailto'}) ¦¦ die "Can't open $mailprog!\n";<br>
print MAIL "Reply-to: ".$FORM{'mailto'}."\n";<br>
print MAIL "Errors-to: ".$FORM{'mailto'}."\n";<br>
print MAIL "From: ".$FORM{'mailto'}."\n";<br>
print MAIL "To: ".$FORM{'mailto'}."\n";<br>
if($FORM{'subject'}) {<br>
print MAIL "Subject: ".$FORM{'subject'}."\n";<br>
} else {<br>
print MAIL "Subject: E-Mail Form Results\n";<br>
}<br>
print MAIL "========================================\n\n";<br>
<br>
$counter=1;<br>
while($FORM{'m'.$counter}) {<br>
$theline=$FORM{'m'.$counter};<br>
$theline=~ s/\[([A-Za-z0-9]*)\]/$FORM{$1}/g;<br>
print MAIL $theline."\n";<br>
$counter++;<br>
}<br>
<br>
print MAIL "\n========================================\n";<br>
print MAIL "Entry made from ".$ENV{'REMOTE_ADDR'}."\n";<br>
print MAIL "Referring URL: ".$ENV{'HTTP_REFERER'}."\n";<br>
<br>
close(MAIL);<br>
<br>
&success;<br>
<br>
exit 0;<br>
<br>
sub success {<br>
if($FORM{'success'}) {<br>
&bounce($FORM{'success'});<br>
} else {<br>
print "Content-type: text/html\n\n";<br>
print "<html>\n<body>\n<center><font size=5>Thanks!</font></center>\n</body>\n</html>\n";<br>
}<br>
return;<br>
}<br>
<br>
sub failure {<br>
if($FORM{'failure'}) {<br>
&bounce($FORM{'failure'});<br>
} else {<br>
print "Content-type: text/html\n\n";<br>
print "<html>\n<body>\n<center><font size=5>You didn't enter the required information</font><p><font size=4>Please <a href=\"".$ENV{'HTTP_REFERER'}."\">return</a> to the form.</center>\n</body>\n</html>\n";<br>
}<br>
exit 0;<br>
}<br>
<br>
sub bounce {<br>
local ($url)=@_;<br>
print "Content-type: text/html\n";<br>
print "Location: ".$url."\n\n";<br>
print "<html><body></body></html>\n";<br>
return;<br>
}<br>
<br>
<br>
Thanks to all,<br>
<br>
Brian Yager