n/oldblog
Archived
1
0
Fork 0
This repository has been archived on 2024-02-13. You can view files and clone it, but cannot push or open issues or pull requests.
oldblog/liens/html/look4word.php

121 lines
3 KiB
PHP
Raw Permalink Normal View History

2023-04-30 21:28:42 +02:00
<?
#############################################
# phpDirectory v1.0 #
# #
# Jean-Yves Fort - 21 avril 2001 #
# jean-yves@lozere-online.com #
# #
# Consulter les documents du repertoire #
# /doc pour plus d'informations sur #
# l'installation, l'auteur, les conditions #
# d'utilisation. #
#############################################
?>
<?php
// variable indiquant le nombre de resultats par pages
$nr=20;
echo "<table width=450><tr><td>";
$link = mysql_connect("$host","$user","$password");
$z = strtr($z,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>","aaaaaaaaaaaaooooooooooooeeeeeeeecciiiiiiiiuuuuuuuuynn");
$z = str_replace('+', ' ', trim($z));
$z = str_replace('\\\'', ' ', $z);
$z = str_replace(',', ' ', $z);
$z = str_replace(':', ' ', $z);
$z=lire($z);
$mots = split( " ", $z );
$phrase = '';
$texte = '';
for ($i = 0; $i < count( $mots ); $i ++)
{
if ( $i == 0 )
{
$texte = ' : ';
}
else
{
$phrase .= " and ";
$texte .= " et ";
}
$phrase .= "(nomsite like '%$mots[$i]%' or description like '%$mots[$i]%' or mcles like '%$mots[$i]%')";
$texte .= "<b><a href=\"index.php?m=l&s=1&z=".$mots[$i]."\">".$mots[$i]."</a></b>";
}
$requete=mysql_db_query($base,"select nomsite, id, description, mcles, url, cat1 from ".$basesites." where ".$phrase." and valid=1 ",$link);
$num=mysql_num_rows( $requete );
if ($z=="")
{
echo "Veuillez saisir un ou plusieurs mot-cl&eacute;s<br><br>";
}
elseif (eregi(".*%+.*", $z))
{
echo "D&eacute;sol&eacute;, le caract&egrave;re % est interdit<br><br>";
}
elseif (strlen($z)<2)
{
echo "Veuillez saisir au moins 2 caract&egrave;res<br><br>";
}
elseif ($num==0)
{
echo "Aucun r&eacute;sultat &agrave; votre recherche".$texte."<br><br>";
}
else
{
if ($num==1) {echo "<b>".$num."</b> site correspond &agrave; votre recherche".$texte."<br><br>";}
else {echo "<b>".$num."</b> sites correspondent &agrave; votre recherche".$texte."<br><br>";}
// nb de pages
$nb_pages=(int)(($num-1)/$nr+1);
// affichage des resultats
if (!isset($page)) {$page=1;}
$n=($page-1)*$nr;
$n_end=$n+$nr;
while(($n<$num)and($n<$n_end))
{
$id=mysql_result($requete,$n,"id");
$sitenom=mysql_result($requete,$n,"nomsite");
$description=mysql_result($requete,$n,"description");
$url=mysql_result($requete,$n,"url");
$cat=mysql_result($requete,$n,"cat1");
$sitenom=enregistre($sitenom);
$description=enregistre($description);
include("html/show.php");
$n++;
}
// pages de resultats
if ($nb_pages>1)
{
$recherche=urlencode($z);
$n=1;
echo "pages de r&eacute;sultats:";
while($n<=$nb_pages)
{
if ($n==$page){echo "<font color=\"red\"> $n</font>";}
else
{echo " <a href=index.php?m=l&s=1&z=$recherche&page=$n>$n</a>";}
$n++;
}
}
}
echo "</td></tr></table><br>";
include("html/zbox.php");
?>