Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/www/include/recherche.php

(Deskargatu)
<div class="full">
<h3>Recherche sur le site</h3>
<?
    $dans = array();
    if (isset($_GET['q']))
    {
	$recherche = $_GET['q'];
	echo "<h5>R&eacute;sultats de la recherche pour :  $recherche</h5>";
	
	if ($_GET['h'] == 1)
	{
	    if ($_GET['news'] == "on") { array_push($dans,"news"); }
	    if ($_GET['articles'] == "on") { array_push($dans,"articles"); }
	    if ($_GET['concours'] == "on") { array_push($dans,"concours"); }	    
	    if ($_GET['bagues'] == "on") { array_push($dans,"bagues"); }	    	    
	    if ($_GET['membres'] == "on") { array_push($dans,"membres"); }	    	    	    
	}
	else 
	{
	$dans = array("news","articles","concours","bagues","membres");
	}

	foreach($dans as $key)
	{
	    echo "<h3>R&eacute;sultats dans la table $key</h3>\n";
	    if ($key == "bagues")
	    {
		$query = "SELECT * FROM mp_pigeon WHERE bague LIKE '%".$recherche."%'";
		$result = mysql_query($query) or die(mysql_error());
		if (mysql_num_rows($result) == 0) { echo "<p>Pas de resultats pour <b>$recherche</b> dans les ".$key."</p>\n"; }
		else 
		{
		    echo "<ul>";
	    	    while($row = mysql_fetch_assoc($result))
		    {
		        echo "<li><a href=\"http://".$row{'pseudo'}.".monpigeonnier.be/index.php?page=pigeons&amp;id=".$row{'id'}."\">Pigeon bagu&eacute; ".$row{'bague'}."</a> : Propri&eacute;taire ".$row{'pseudo'}."</li>";
		    }
		    echo "</ul>";
		}
	    
	    
	    }
	    elseif($key == "membres")
	    {
		$query = "SELECT * FROM mp_membres WHERE pseudo LIKE '%".$recherche."%'";
		$result = mysql_query($query) or die(mysql_error());
		if (mysql_num_rows($result) == 0) { echo "<p>Pas de resultats pour <b>$recherche</b> dans les ".$key."</p>\n"; }
		else 
		{
		    echo "<ul>";
		    while($row = mysql_fetch_assoc($result))
			{
			echo "<li><a href=\"http://".$row{'pseudo'}.".monpigeonnier.be/index.php\">Page perso de ".$row{'pseudo'}."</a></li>";
			}
		    echo "</ul>";
		}
	    }
	    else
	    {
		$query = "SELECT * FROM mp_$key WHERE pseudo LIKE '%".$recherche."%' or contenu LIKE '%".$recherche."%'";
		$result = mysql_query($query) or die(mysql_error());
		if (mysql_num_rows($result) == 0) { echo "<p>Pas de resultats pour <b>$recherche</b> dans les ".$key."</p>\n"; }
		else 
		{
		    echo "<ul>";
    		    while($row = mysql_fetch_assoc($result))
		{
		    echo "<li><a onclick=\"window.open('popup.php?page=".$key."&amp;id=".$row{'id'}."','','width=400,height=300')\" href=\"#\">".$row{'titre'}."</a></li>";
		}
		    echo "</ul>";
	    }
	    }
	    
	    
	    
	    
	
	}
	
	
	
	
    }
    
    else {
	echo "<form action=\"index.php\">
	
	<dl>
	
	<dt><input type=\"hidden\" name=\"page\" value=\"recherche\" /><input type=\"hidden\" name=\"h\" value=\"1\" />
	Rechercher</dt>
	<dd><input type=\"text\" name=\"q\" value=\"\" /></dd>
	<dt>Rechercher dans</dt>
	<dd>
	    <dl>
		<dt>News</dt><dd><input type=\"checkbox\" name=\"news\" /> </dd>
		<dt>Articles</dt><dd><input type=\"checkbox\" name=\"articles\" /> </dd>
		<dt>Concours</dt><dd><input type=\"checkbox\" name=\"concours\" /> </dd>	    
		<dt>Bagues des pigeons</dt><dd><input type=\"checkbox\" name=\"bagues\" /> </dd>		
		<dt>Membres</dt><dd><input type=\"checkbox\" name=\"membres\" /> </dd>				
	    </dl>
	</dd>
	<dt>Validation</dt>
	<dd><input type=\"submit\" value=\"Rechercher\" /></dd>
	
	
	</dl>
	</form>
	
	";
    }
    
?>
	
</div>