I am looking for a quick 'if' statement to prevent hackers from pasteing into a field through a form to a cgi script .
Now I know I can use a maxlength through the HTML doc, but this won't prevent the problem (I have already considered) .
I assume it would be something like "
$MAXLENGTH= 10;
if ($field =~ ->'/$MAXLENGTH/) {
&to_long_sub;
exit;
}
I have also toyed with the idea of:
if ($form{'action'} eq "cgi_form"){
&to_long_sub unless $form{'-<'$MAXLENGTH'};
}
But none of the above are quite right ,infact some examples I have seen make me realise I am well off base. Can anyone supply me with a simple bit of 'if' code for the script please!
Now I know I can use a maxlength through the HTML doc, but this won't prevent the problem (I have already considered) .
I assume it would be something like "
$MAXLENGTH= 10;
if ($field =~ ->'/$MAXLENGTH/) {
&to_long_sub;
exit;
}
I have also toyed with the idea of:
if ($form{'action'} eq "cgi_form"){
&to_long_sub unless $form{'-<'$MAXLENGTH'};
}
But none of the above are quite right ,infact some examples I have seen make me realise I am well off base. Can anyone supply me with a simple bit of 'if' code for the script please!