Bonsoir,
Alors j'ai un soucis, je voudrais enlever les "anti-slashes" (ou backslashes) plus rapidement!
Dans ma table j'ai 28 colonnes donc si je me fie à la notice PHP, j'ai autant de addslashes à mettre
ex de mon code :
if(!empty($_POST)){
extract($_POST);
$titre=str_replace("\'","'",$titre);
$titre=addslashes($titre);
$texte=str_replace("\'","'",$texte);
$texte=addslashes($texte);
$photo=str_replace("\'","'",$photo);
$photo=addslashes($photo);
$titre1=str_replace("\'","'",$titre1);
$titre1=addslashes($titre1);
$paragraphe1=str_replace("\'","'",$paragraphe1);
$paragraphe1=addslashes($paragraphe1);
$titre2=str_replace("\'","'",$titre2);
$titre2=addslashes($titre2);
$paragraphe2=str_replace("\'","'",$paragraphe2);
$paragraphe2=addslashes($paragraphe2);
$titre_actu1=str_replace("\'","'",$titre_actu1);
$titre_actu1=addslashes($titre_actu1);
$titre_actu2=str_replace("\'","'",$titre_actu2);
$titre_actu2=addslashes($titre_actu2);
$titre_actu3=str_replace("\'","'",$titre_actu3);
$titre_actu3=addslashes($titre_actu3);
$titre_actu4=str_replace("\'","'",$titre_actu4);
$titre_actu4=addslashes($titre_actu4);
$actu1=str_replace("\'","'",$actu1);
$actu1=addslashes($actu1);
$actu2=str_replace("\'","'",$actu2);
$actu2=addslashes($actu2);
$actu3=str_replace("\'","'",$actu3);
$actu3=addslashes($actu3);
$actu4=str_replace("\'","'",$actu4);
$actu4=addslashes($actu4);
$titre_tarifs=str_replace("\'","'",$titre_tarifs);
$titre_tarifs=addslashes($titre_tarifs);
$tarifs=str_replace("\'","'",$tarifs);
$tarifs=addslashes($tarifs);
$titre_parcours=str_replace("\'","'",$titre_parcours);
$titre_parcours=addslashes($titre_parcours);
$parcours=str_replace("\'","'",$parcours);
$parcours=addslashes($parcours);
$titre_consignes=str_replace("\'","'",$titre_consignes);
$titre_consignes=addslashes($titre_consignes);
$consignes=str_replace("\'","'",$consignes);
$consignes=addslashes($consignes);
$titre_fiches=str_replace("\'","'",$titre_fiches);
$titre_fiches=addslashes($titre_fiches);
$fiches=str_replace("\'","'",$fiches);
$fiches=addslashes($fiches);
N'y a t'il pas un moyen de modifier ça ?
Une variable globale ???
Merci
<?php
if(!empty($_POST)){
foreach($_POST as $k => $v){
$_POST$k] = str_replace("\'", "'", $v);
$_POST$k] = addslashes($v);
}
extract($_POST);
}
Alors voilà j'ai trouvé ça :
foreach($_POST as $k=>$v)
{
$_POST$k] = str_replace("\'","'",$v);
$_POST$k] = addslashes($v);
}
Manque de bol, ça ne fonctionne pas! Pourtant ça a l'air pas mal...
Qu'est ce qu'il ne va pas dans mon code ??
<?php
if(!empty($_POST)){
foreach($_POST as $k => $v){
$_POST$k] = addslashes(str_replace("\'", "'", $v));
}
extract($_POST);
}