Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/04/2005, 13:01
latinhospedaje
 
Fecha de Ingreso: octubre-2003
Mensajes: 19
Antigüedad: 21 años, 4 meses
Puntos: 0
Como modifico este script

¿Ete script bloquea las palabras de la lista cuando son escritas en algun campo de un formulario. ¿Como puedo cambiar este script para que bloquee tambien palabras que comiencen con las de la lista?



my $dbh = &AUC::DB::dbh();

# profanity to check for in submissions
my @profanity = (
"fuck",
"shit",
"asshole",
"pussy",
"cock",
"dickhead",
"butthole",
"bitch",
"bastard",
"asswipe",
"moron",
"jerk",
"cunt",
"fingered",
"fuckme",
"fuckyou",
"oarpha"
);




################################################## ##############################



################################################## ##############################
# SUBROUTINES
################################################## ##############################

################################################## ##############################
#
# Sub: containsSwears
# Description: This will check the given field for illegal words
#
#
# Input: string
#
#
# Output: 0 - False, 1 - true
#
################################################## ##############################
sub containsSwears
{
my $textToCheck = shift;
my $i;
my $retval = 0;

for $i ( 0 .. $#profanity)
{
if ($textToCheck =~ /\b$profanity[$i]\b/i)
{
$retval = 1;
}
}
return $retval;
}


################################################## ##############################