Bonjour,
Pour un petit blog j'utilise le cms
PluXml et dans la
Wiki PluXml il y'a un code pour
ajouter_un_moteur_de_recherche_dans_une_page_statique ajouter un moteur de recherche à partir d'une page statique.
<?php
# Page statique Pluxml : moteur de recherche
# revision 1.0 par Stephane :
# - compatibilité pluxml 4.2
# - paramètrage du format de la date
if(!defined('PLX_ROOT')) exit;
# Renseignez ici le format de la date
$format_date = '#num_day/#num_month/#num_year(4)';
global $plxShow;
if (!empty($_POST['searchfield'])) {
$plxGlob_arts = new plxGlob(PLX_ROOT.$plxShow->plxMotor->aConf['racine_articles']);
$aFiles = $plxGlob_arts->query('/[0-9]{4}.([0-9]{3}|home).[0-9]{12}.[a-z0-9-]+.xml$/','search','rsort');
if(is_array($aFiles)) { # On a des fichiers
$searchword = strtolower(addslashes($_POST['searchfield']));
ob_start();
while(list($k,$v) = each($aFiles)) { # On parcourt tous les fichiers
$art = $plxShow->plxMotor->parseArticle(PLX_ROOT.$plxShow->plxMotor->aConf['racine_articles'].$v);
$searchstring = strtolower(addslashes($art['title'].$art['chapo'].$art['content']));
if (strpos($searchstring,$searchword) !== false) {
$searchresults = true;
$art_num = intval($art['numero']);
$art_url = plxUtils::strCheck($art['url']);
$art_title = plxUtils::strCheck($art['title']);
$art_date = plxDate::dateIsoToHum($art['date'], $format_date);
echo '<li>'.$art_date.': ['.$plxShow->plxMotor->aConf['racine'].'?article'.$art_num.'/'.$art_url.' '.$art_title.']</li>';
}
}
$content = ob_get_clean();
if ($content!='')
echo 'Résultats de la recherche.
<ol class="search_results">'.$content.'</ol>
';
else
echo 'Aucun résultat pour '.$searchword.'
';
}
}
?>
<form method ="post" id="searchform" action="<?php echo PLX_ROOT ?>?<?php $plxShow->get() ?>">
</form>
Mon Problemme c'est que ce moteur de recherche présente
Faille XSS
Si c'est grave !
Comment résoudre ce problème ?
Merci