Ajout de fonctions de validation pour chaque attribut avec un nom différents dans les tables de la base de données, auparavant il n'y avit que celle pour la connection de l'administrateur du formulaire
continuous-integration/drone/push Build is passing Details

LoginModification
Johan LACHENAL 2 years ago
parent 238a111a6b
commit 5755fe4469

@ -54,7 +54,62 @@ class Validate
else return false;
}
/**
* Vérifie si le mot-clé est valide.
*
* @param string $keyword Le mot-clé à vérifier.
* @return bool Vrai si le mot-clé est valide, faux sinon.
*/
static function keyWord($keyword) : bool
{
global $keyWordMaxLength;
if (isset($keyword) && strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3)
return true;
else return false;
}
/**
* Vérifie si le titre est valide.
*
* @param string $title Le titre à vérifier.
* @return bool Vrai si le titre est valide, faux sinon.
*/
static function title($title) : bool
{
global $titleMaxLength;
if (isset($title) && strlen($title) <= $titleMaxLength && strlen($title) >= 3)
return true;
else return false;
}
/**
* Vérifie si le type est valide.
*
* @param string $type Le type à vérifier.
* @return bool Vrai si le type est valide, faux sinon.
*/
static function type($type) : bool
{
global $typeMaxLength;
if (isset($type) && strlen($type) <= $typeMaxLength && strlen($type) >=3)
return true;
else return false;
}
/**
* Vérifie si la réponse est valide.
*
* @param string $response La réponse à vérifier.
* @return bool Vrai si la réponse est valide, faux sinon.
*/
static function response($response) : bool{
global $responseMaxLength;
if(isset($response) && strlen($response) <= $responseMaxLength)
return true;
else return false;
}
}

@ -9,4 +9,9 @@ $views['admin'] = 'Views/HTML/admin.php';
$emailMaxLength=150;
$pseudoMaxLength=50;
$passwordMaxLength=500;
$passwordMaxLength=500;
$keyWordMaxLength=50;
$titleMaxLength=50;
$typeMaxLength=50;
$responseMaxLength=200;

Loading…
Cancel
Save