PHP, FONCTION DE FILTRE _POST PERSONNEL
Profil bloqué
-
miramaze Messages postés 1429 Date d'inscription Statut Contributeur Dernière intervention -
miramaze Messages postés 1429 Date d'inscription Statut Contributeur Dernière intervention -
bonjour, je viens de mettre en place une fonction qui va me permettre de supprimer tous caractère speciaux et autres que je n'aurais pas autoriser depuis le tableau POST. Je crains avoir fait des erreurs ou avoir plutôt fait une betise. aidez moi a corriger le code. est ce que la valeur retourner (ici un array) peut l'être?
//PROTECTION CONTRE LES DONNÉES SAISIES.
function cleanUserTab($tab){
foreach($tab AS $colone=>$saValeur){
if(preg_match('/[^a-zA-Z0-9@-_\.\s]+/', $tab['$colone'])){
$$colone=preg_replace('/[^a-zA-Z0-9@-_\.\s]+/', '', $tab['$colone']);
return array($$colone,$tab['$colone']);
}
else {
$$colone=$tab['$colone'];
return array($$colone, $tab['$colone']);
}
}
}
NB: J'AIMERAIS A LA SORTIE, FAIRE UN TRUC DU GENRE.
<?php
cleanUserTab ($_POST);
echo $nom;
zcho $prenom;
?>
DONC EN GROS, JE VEUX CREER UNE FONCTION QUI JOUE LE ROLE DE LA FONCTION extract() DE PHP.
//PROTECTION CONTRE LES DONNÉES SAISIES.
function cleanUserTab($tab){
foreach($tab AS $colone=>$saValeur){
if(preg_match('/[^a-zA-Z0-9@-_\.\s]+/', $tab['$colone'])){
$$colone=preg_replace('/[^a-zA-Z0-9@-_\.\s]+/', '', $tab['$colone']);
return array($$colone,$tab['$colone']);
}
else {
$$colone=$tab['$colone'];
return array($$colone, $tab['$colone']);
}
}
}
NB: J'AIMERAIS A LA SORTIE, FAIRE UN TRUC DU GENRE.
<?php
cleanUserTab ($_POST);
echo $nom;
zcho $prenom;
?>
DONC EN GROS, JE VEUX CREER UNE FONCTION QUI JOUE LE ROLE DE LA FONCTION extract() DE PHP.
A voir également:
- PHP, FONCTION DE FILTRE _POST PERSONNEL
- Fonction si et - Guide
- Photo filtre 7 gratuit - Télécharger - Retouche d'image
- Pointage du personnel excel - Télécharger - Tableur
- Rt.comptable personnel - Télécharger - Banque & Budget
- Filtre whatsapp - Accueil - Messagerie instantanée