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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| <html>
<head>
<title>Résultat de la recherche</title>
<STYLE type=text/css>
A:link{ COLOR: #c0c0c0;TEXT-DECORATION: none }
A:visited{ COLOR: #ffffff;TEXT-DECORATION: none }
A:hover { COLOR: #00ff00;TEXT-DECORATION: none }
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body text="#FFFFFF" bgcolor="#000000" link="#9999FF" vlink="#6699FF" alink="#FFFF00">
<font face="Verdana" size=2>
<form action="moteur.php3" method="post">
<?php include("config.inc.php");?>
<?php
$db_link = mysql_connect("$sql_serveur","$sql_user","$sql_passwd");
$mot=strtolower($mot);
$mots=split(" ",$mot);
$nombre_mots=count($mots);
$z=1;
$texte=" contenant le mot <font color=00ff00>$mots[0]</font>";
$phrase="'%$mots[0]%'";
while($z<$nombre_mots)
{
$phrase.=" ".$et_ou." mots like '%$mots[$z]%'";
$texte.=" ";
if($et_ou=="and"){$texte.="et";}else{$texte.="ou";}
$texte.=" "$mots[$z]"";
$z++;
}
if($debut==""){$debut=0;}
$debut=$page*$limit;
$requete=mysql_db_query("$sql_bdd","select count(*) from moteur where mots like $phrase order by id",$db_link);
$nb_total=mysql_result($requete,0,"count(*)");
$requete=mysql_db_query("$sql_bdd","select * from moteur where mots like $phrase limit $debut,$limit",$db_link);
$num=mysql_num_rows($requete);
if ($num==0) {echo "Désolé, aucune page de ce site ne contient $mot...";}
else if ($mot=="") {echo "Veuillez saisir un ou plusieurs mot-clés avant de cliquer sur 'OK' !";}
else if (strlen($mot)<2) {echo "Veuillez saisir au moins 2 caractères.";}
else {
echo "$nb_total réponse";
if ($nb_total>1) {echo "s";}
echo "$texte";
$i=0;
while($i<$num)
{
$description=mysql_result($requete,$i,"description");
echo "<br><br></b>$description<br><font size=1></font>\n";
$i++;
}
echo "<br><br>";
if ($page>0)
{
$precedent=$page-1;
print "<img src=images/fleche3.gif align=middle border=0><img src=fleche3.gif align=middle border=0> <a href=\"$script_name?page=$precedent&mot=$mot\">page précédente</a> \n";
}
$i=0;$j=1;
if($nb_total>$limit)
{
while($i<($nb_total/$limit))
{
if($i!=$page){echo "<a href=\"$script_name?page=$i&mot=$mot\">$j</a> ";}
else {echo "<font color=00ff00>$j</font> ";}
$i++;$j++;
}
}
if($debut+$limit<$nb_total)
{
$suivant=$page+1;
echo "<a href=\"$script_name?page=$suivant&mot=$mot\">page suivante</a> <img src=fleche.gif align=middle border=0><img src=images/fleche.gif align=middle border=0> ";
}
}
mysql_close($db_link);
?>
</font>
</form>
</body>
</html> |
Partager