include("../scripts-styles/column_left.php"); ?>
|
|
$searchterms = $_POST['searchterms'];
?>
if ($searchterms) {
$dir = "../";
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$filetype = filetype($dir . $file);
#echo "filename: $file : filetype: " . $filetype . " \n";
if ($filetype == "dir") {
$dirlist[]=$file;
}
}
closedir($dh);
}
sort($dirlist);
foreach ($dirlist as $val) {
if ($val != "." && $val != ".." && $val != "images" && $val != "site_images" && $val != "Templates" && $val != "secureadmin" && $val != "scripts-styles") {
$dir = "../$val/";
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if (eregi("\.php",$file)) {
$filelist[] = $dir.$file;
}
}
closedir($dh);
}
}
}
sort($filelist);
foreach ($filelist as $val) {
$filetext = file_get_contents($val);
if (eregi($searchterms,$filetext)) {
#get page title
$filesplit = split("\<\/title\>",$filetext);
$filesplit = split("\ ",$filesplit[0]);
$title = $filesplit[1];
$filesplit = split("\<\/body\>",$filetext);
$filesplit = split("\",$filesplit[0]);
$body = strip_tags($filesplit[1]);
$body = trim($body);
$body = eregi_replace(" "," ",$body);
$body = eregi_replace("\n","",$body);
$body = substr($body,0,255);
if ($title) {
$searchlist[] = $val;
$searchtitle[$val]=$title;
$searchbody[$val]=$body;
}
}
}
?>
if ($searchlist) {
foreach ($searchlist as $val) {
$filecount++;
?>
= $searchtitle[$val]; ?>
= $val; ?>
= $searchbody[$val]; ?>...
}
}
?>
if ($filecount < 1) { ?>
We didn't find any pages with the term(s): = $searchterms; ?>
} else { ?>
Your search for "= $searchterms; ?>" has returned = $filecount; ?> page(s).
} ?>
} ?>
|
|
include("../scripts-styles/column_right.php"); ?> |