<center>

<?php
if(isset($_POST['motcle'])) {

$motcle = stripslashes($_POST['motcle']);
// on remplace les caractères spéciaux
$motcle = str_replace(array('à','á','â','ã','ä','å'),'a',$motcle);
$motcle = str_replace(array('ò','ó','ô','õ','ö','ø'),'o',$motcle);
$motcle = str_replace(array('è','é','ê','ë'),'e',$motcle);
$motcle = str_replace('ç','c',$motcle);
$motcle = str_replace(array('ì','í','î','ï'),'i',$motcle);
$motcle = str_replace(array('ù','ú','û','ü'),'u',$motcle);
$motcle = str_replace('ÿ','y',$motcle);
$motcle = str_replace('ñ','n',$motcle);
// passage des majuscule en minuscule
$motcle = strtolower($motcle);

$search_list = explode("\n", htmlentities($motcle));
$tmp = 0;

foreach($search_list as $search_string) {

/* liste de la categorie */
//$categories = stripslashes($_POST['categories']);

	//$url_journaux = 'http://www.journaux.fr/recherche.php?txtRecherche='.$search_string.$categories;
	$url_journaux = 'http://www.journaux.fr/recherche.php?txtRecherche='.$search_string.'&type=1&x=0&y=0';
	$url_journaux = str_replace(" ","+",$url_journaux);

	list($Magas,$erreur) = getListMagaJournaux($url_journaux);

	if(!empty($Magas)) {
		foreach($Magas as $unMaga)
		{
			echo '<form name="allocine" method="post" action="index.php?page=magazines&action=info">';
			echo '<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">';
			echo '<tr><td height="91" valign="bottom" background="./images/img_maga/f_maga_h.png"><table width="200" border="0" cellspacing="0" cellpadding="0">';
			echo '<tr>';
			echo '<td width="170" height="33" align="center">';
			echo '<input type="hidden" name="magainfo['.$tmp.'][titre]" value="'.$unMaga['titre'].'">';
			echo '<input type="hidden" name="magainfo['.$tmp.'][id]" value="'.$unMaga['id'].'" />';
			echo '<input type="image" src="./images/fiche_valid.png" border="0" name="go" title="Selectionner cette Fiche" onmouseover="javascript:this.src=\'./images/fiche_valid1.png\';" onmouseout="javascript:this.src=\'./images/fiche_valid.png\';" /></td>';
			echo '<td align="center"><a href="http://www.journaux.fr/'.$unMaga['id'].'" target="_blank">';
			echo '<img src="./images/img_maga/maga.png" title="Voir la Fiche Complète" width="38" height="26" border="0" onmouseover="javascript:this.src=\'./images/img_maga/maga1.png\';" onmouseout="javascript:this.src=\'./images/img_maga/maga.png\';" /></a></td>';
			echo '</tr><tr><td height="33"></td><td></td></tr></table></td></tr><tr>';
			echo '<td background="./images/img_maga/f_maga_c.png">';
			echo '<div class="ebooks" ><table border="0" cellspacing="0" cellpadding="0">';
			echo '<tr><td width="10"></td><td rowspan="2">';

            echo '<div style="background:url(./images/list/book.png); "><img src="'.$unMaga['affiche'].'" border="0" width="110" height="156" style="border: 5px solid transparent;" title="Affiche de '.$unMaga['titre'].'" /></div></td><td width="30"></td><td width="550"><div style="border:#000000 1px solid; background:url(./images/img_maga/list_ebook.gif); background-repeat: repeat-x;">';

			echo '<span class="noir"><strong>Titre :</strong> '.$unMaga['titre'].'<br />';
			echo '<strong>Parution/n° :</strong> '.$unMaga['edition'].'<br />';
			echo '<strong>Prix :</strong> '.$unMaga['infos'].'</span><br />';
			echo '</div></td></tr>';
			echo '</table></center></div>';
			echo '<br /></td></tr><tr><td height="13" background="./images/img_maga/f_maga_b.png"></td></tr></table>';
			echo '</form><br />';
			$tmp++;
		}
	}else{
		if(!empty($erreur)) {
		echo '<center><meta http-equiv="refresh" content="5;url='.$PHP_SELF.'?page=magazines" />';
		echo '<div style="background-color:#FFCCCC; border:#000000 1px double; width:100%;">';
		echo '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">';
		echo '<tr>';
		echo '<td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0" /></td>';
		echo '<td width="100%" align="center" valign="middle"><p>! --- ### ATTENTION ### --- !</p>';
		echo '<p>Une erreur s\'est produite, Veuillez nous en escuser ....</p>';
		echo '<p>&raquo; La cause de cette erreur est certainement due au serveur interne</p>';
		echo '<p>&raquo; Veuillez patientez le temp de la maintenance des techniciens, utiliser la version Prez-Manuelle</p>';
		echo '<p>( Redirection dans 5 secondes)</p></td>';
		echo '<td align="center" valign="middle"><img src="./images/Panneauattention.png" hspace="10" vspace="10" border="0" /></td>';
		echo '</tr></table></div><br /><a href="?page=magazines"><input name="manuel" value="manuel" type="hidden" /><img src="./images/err.png" title="Erreur de recherche" border="0" onmouseover="javascript:this.src=\'./images/err1.png\';" onmouseout="javascript:this.src=\'./images/err.png\';" alt="VisualPreZZ" /></a><br />
<script language="javascript" type="text/javascript">
//<![CDATA[
google_ad_client = "pub-5294692897836007";
google_ad_slot = "7634590533";
google_ad_width = "468";
google_ad_height = "60";
//]]>
</script>
<script language="JavaScript" type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></center>';
	}else{
		echo '<center><meta http-equiv="refresh" content="5;url='.$PHP_SELF.'?page=magazines" />';
		echo '<div style="background-color:#FFCCCC; border:#000000 1px dashed; width:100%;">';
		echo '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">';
		echo '<tr>';
		echo '<td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0" /></td>';
		echo '<td width="100%" align="center" valign="middle"><p>! --- ### ATTENTION ### --- !</p>';
		echo '<p>&quot; Vous avez specifié un mot clé incorrect , ou il n\'existe pas &quot;</p>';
		echo '<p>Veuillez retaper un mot clé svp ...</p>';
		echo '<p>( Redirection dans 5 secondes)</p></td>';
		echo '<td align="center" valign="middle"><img src="./images/Aide.png" hspace="10" vspace="10" border="0" /></td>';
		echo '</tr></table></div><br /><a href="?page=magazines"><input name="manuel" value="manuel" type="hidden" /><img src="./images/err.png" title="Erreur de recherche" border="0" onmouseover="javascript:this.src=\'./images/err1.png\';" onmouseout="javascript:this.src=\'./images/err.png\';" alt="VisualPreZZ" /></a><br />
<script language="javascript" type="text/javascript">
//<![CDATA[
google_ad_client = "pub-5294692897836007";
google_ad_slot = "7634590533";
google_ad_width = "468";
google_ad_height = "60";
//]]>
</script>
<script language="JavaScript" type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></center>';
	}
	}

}
}else{
	echo '<meta http-equiv="refresh" content="0; url='.$PHP_SELF.'?page=magazines" />';
}
?>

</center>