du style :
function validate_string($string, $optional = false, $min = 0, $max = 0)
{
if (empty($string) && $optional)
{
return false;
}
if ($min && strlen(htmlspecialchars_decode($string)) < $min)
{
return false;
}
else if ($max && strlen(htmlspecialchars_decode($string)) > $max)
{
return false;
}
return true;
}
Ce sont les controle de phpbb que j'utilise ;)
la tu fait
if (!validate_string($_POST['
titre'], true, 0, 100)) echo 'Titre incorrect !';
Citt_jr
Bats toi avec les meilleurs, crève avec le reste
[ Lien ]