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 à partir d'une page statique.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?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.': <a href="'.$plxShow->plxMotor->aConf['racine'].'?article'.$art_num.'/'.$art_url.'">'.$art_title.'</a></li>'; 
			}
		}
		$content = ob_get_clean(); 
		if ($content!='')
			echo '<p>Résultats de la recherche.<br /><ol class="search_results">'.$content.'</ol></p>';
		else
			echo '<p>Aucun résultat pour <strong>'.$searchword.'</strong></p>';
	}
}
?>
 
<form method="post" id="searchform" action="<?php echo PLX_ROOT ?>?<?php $plxShow->get() ?>">
<p class="searchform">
	<input type="hidden" name="search" value="search"  />
	<input type="text" class="searchfield" name="searchfield" value="Rechercher..." onblur="if(this.value=='') this.value='Rechercher...';" onfocus="if(this.value=='Rechercher...') this.value='';" /> 
	<input type="submit" class="searchbutton" value="Go" />
</p>
</form>
Le Probleme c'est que ce moteur de recherche présente Faille XSS



Comment résoudre ce problème ?

Merci