Voilà le code. Il y'a une autre page .php mais je ne crois pas qu'elle soit intéressante, elle envoie juste la valeur remplie dans le champ.
Si tu peux m'aider avec ca, merci....
<?
if (!empty($keywords))
{
?> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000">
Vous recherchiez <b><? print ($keywords); ?></b> <?
/* this script must reside in your root directory and will search recursively down through your web site
this script is written to work with php3 - if you are running php4, simply remove the 3 from the file name reference
make the same modification in the form tag on our search page*/
$key = escapeshellcmd ($keywords); // let's make sure any metacharacters get escaped so as not to wreak havoc with our host
$tcount = 0; // initialize our file count
function scroll($current, $terms, &$total)
{ //print $terms;
$handle=opendir($current); // open the directory passed as the first argument
while (($file = readdir($handle))!=false) // keep cycling through all the files
{ $first = ""; // initialize first occurance of the match
$fcount = 0; // initialize number of matches per file
$found = false; // initialize flag - true or false
$no_title = true;
$file_p = $current . "/" . $file; // create the path to the file for the a href
if (($file != ".") && ($file != "..")) // ignore . and .. files
{
if (is_file($file_p) && (substr($file,0,1) != "_") && ((substr(strrev($file),0,1) == "l") || (substr(strrev($file),0,1) == "m") ||(substr(strrev($file),0,3) == "php"))) // limit our search to
// php3, php, html, htm and txt files
{
$file_b = fopen($file_p, "r"); // open the file for reading
while (!feof($file_b)) // continue to end of line
{ $line = fgets($file_b, 2000); // try and remove all data between <> when reading
$line = trim($line); // trim any leading or trailing white space
if (!empty($line))
{ //print $line;
if ($no_title == true)
{ preg_match ("/title+[\w\W]*title+/i", $line, $matches);
if ($matches)
{ $title = $matches[0];
$no_title = false;}
}
$newline = eregi_replace ("(<'.*>)", "", $line);
if ((strpos($newline , $terms) >=0 ) && (strpos($newline , $terms))) // check that line for a match, using the keywords, the line, and returning an array of the matches
{//print "match found" . strpos($newline , $terms);
$found = true; // set flag
$fcount++; //increment total found for this file
if ($first == "")
{
$first = $newline ; // set the variable to display the first line where the match occurred
}
}
}
}
if ($found == true)
{ $len = strlen($file_p); // this allows us to print the link, ignoring the starting /
$this_title = ereg_replace ("title", "", $title);
$this_title = preg_replace ("/>/", "", $this_title);
$this_title = preg_replace ("/</", "", $this_title);
$this_title = eregi_replace ("<", "", $this_title);
$this_title = eregi_replace (">", "", $this_title);
$this_title = eregi_replace ("/", "", $this_title);
$this_title = ereg_replace ("/", "", $this_title);
$t_len = strlen($this_title);
$total++; // increment total number of file matches
print ("<p><a href ='" . $file_p . "'>" . $this_title. "</a> contient ". $fcount . " correspondance(s).");
}
}
$found = false;
$no_title = true;
// this is the recursive call
if ((is_dir($file_p)) && (dirname($file_p) != "_private") && (dirname($file_p) != "_someothername"))// if the file is a directory and not a private one
{
$new_dir = $current . "/" . $file;
if (($new_dir != "./mysql") && ($new_dir !="./easyonline/www/www.koppen-lethem.fr/htdocs"))
scroll ($new_dir, $terms, &$total); // call the function recursively when it is a directory
}
// end of if (($file != ".") && ($file != ".."))
}
// end of while (($file = readdir($handle))!=false)
}
closedir($handle); // close the directory
// end of function
}
// print $key;
scroll(".", $key, $tcount); // initial call to the function, passing it the current directory as the start, the cleaned up search terms and the total number of files found - this is passed by reference so it can be incremeneted script-level
if ($tcount > 0)
{
print ("<p>Résultat(s) trouvé(s) : " . $tcount . " correspondant(s).");}
else
{
print ("Pas de réponse pour cette recherche.");}
}
else
{
print ("<p>#");
} // end of keywords not empty
?>