- Home
- Categorie
- Coding e Sistemistica
- PHP
- motore di ricerca red tempest
-
motore di ricerca red tempest
Ciao a tutti
Sto testando il motore di ricerca della redtempest.
Possiede un file php che indicizza i file e li memorizza sul database mysql.
Stranamentè però ne indicizza solo 2 anzichè una cinquantina,
che hanno la stessa estensione, tralatro...
posto il codice del file che indicizza:
[php]<?php
/* RedTempest Search v 2.1.0
Copyright 2000-2002 RedTempestCOPYRIGHT NOTICE
Copyright 2000-2002 RedTempest. All Rights Reserved.This script may be edited/changed as long as you don't remove this
copyright. By using this script you agree to take full responsibility
for it. RedTempest is in no way accountable for any damage caused.
Reselling/Distributing this code without prior written consent is
expressly forbidden. If you have any questions about this copyright,
please contact support: [email protected] */// Variables
// the url to your website
$home = "miosito.com/NUOVO/";// the server path to your home directory
$homedir = "/home/content/m/a/n/miosito/html/NUOVO";// Mysql varialbes
$sql = array(
"user" => "user", // username
"pass" => "pass", // password
"host" => "localhost", // Mysql host
"db" => "dbname" // Mysql database
);// Any directories you don't want included in the search index.
$ex_dir = array('mysql','media','rtadmin');// Any file extensions you don't want included in the search index.
$ex_file = array("php","gif","jpg","zip","ico","js","html","css");// End of variables
// Load files and directories into respective arrays
$dir = array($homedir);
$total = 1;
for($a = 0; $a < $total; $a++){
$this = $dir[$a];
$open = opendir($this);
while($file = readdir($open)){
if($file != ".." && $file != "."){
chdir($this);
if(!is_dir($file) && ex_check_file($file,$ex_file) == 1){
$dir_list[] = "$this/$file";
$file_list[] = $file;
}
elseif(is_dir($file) && ex_check_dir($file,$ex_dir) == 1){
$dir[] = "$this/$file";
$total++;
}
}
}
closedir($open);
}$link = mysql_connect($sql[host],$sql[user],$sql[pass]) or mysql_error();
mysql_select_db($sql**) or mysql_error();mysql_query("delete from rt_search");
for($a = 0; $a < count($file_list); $a++){
$this = $dir_list[$a];
$open = fopen($this, "r");
$data = fread($open, filesize($this));
fclose($open);$tdata = spliti("title>",$data,3); $title = substr($tdata[1],0,-2); $data = strip_tags($data); $temp = explode("\n",$data); $newtemp = ""; foreach($temp as $this){ if(trim($this) != ''){ $newtemp .= "$this\n"; } } $data = $newtemp; $true = substr($dir_list[$a],strlen($homedir)); $true = "$home$true"; mysql_query("insert into rt_search (title,filename,descript,url) values('$title','$file_list[$a]','$data','$true')");
}
echo "Indexed";// Functions
function ex_check_file($file,$ex_file){
foreach($ex_file as $this){
if(substr($file, -strlen($this)) == $this){
$exflag = 1;
}
}
if(!$exflag){return 1;}
}function ex_check_dir($file,$ex_dir){
foreach($ex_dir as $this){
if($this == $file){
$dirflag = 1;
}
}
if(!$dirflag){return 1;}
}?>[/php]
Grazie per l'aiuto