= $GLOBALS['max_word_search_array']){
break;
}
$c++;
}
return $words;
}
if(isset($_GET['search']) && $_GET['search']!="")
{
$searchquery = stripslashes(htmlentities($_GET['search']));
$searchdb = file_get_contents($database);
$searchbuffer = explode("URL: ", $searchdb);
?>
" . $title[0] . "
\n";
echo "
"
. "" . $url[0] . "
"
. $desc[0] . "
\n";
$searchcount++;
}
// IF there's too many finds, don't flood the page
if($searchcount>$maxfinds) { break; }
}
// Didn't find any / lots of direct comparisons to the string
// lets do a simple word by word search algorithm
$searchedbuf = "";
$finalbuf = "";
if($searchcount < "25") {
$searchkeys = filterSearchKeys($searchquery);
$cnt = 1;
foreach($searchkeys as $search) {
if($cnt != count($searchkeys)) {
foreach($searchbuffer as $site2) {
if(stripos($site2, $search) !== false) {
$searchedbuf .= "URL: " . $site2 . "\n";
}
}
}
if($cnt == count($searchkeys)) {
foreach(explode("URL: ", $searchedbuf) as $sitebuf) {
if(stripos($sitebuf, $search) !== false) {
$finalbuf .= "URL: " . $sitebuf . "\n";
}
}
}
$cnt++;
}
$searchbuffer2 = explode("URL: ", $finalbuf);
array_shift($searchbuffer2);
foreach($searchbuffer2 as $searched) {
$url = explode("\n", $searched); // $url[1]
$pretitle = explode("Title: ", $searched);
$title = explode("Description: ", $pretitle[1]);
$predesc = explode("Description: ", $searched); // Used to calculate descriptions with line breaks
$desc = explode("Keywords: ", $predesc[1]); // $desc[0]
echo "
" . $title[0] . "\n";
echo "
"
. "" . $url[0] . "
"
. $desc[0] . "
\n";
$searchcount++;
}
}
echo "
Found $searchcount results
";
echo "
\n";
}
else if(isset($_GET['crawl']) && $_GET['crawl']!="")
{
$crawlurl = htmlentities(stripslashes($_GET['crawl']));
if(filter_var($crawlurl, FILTER_VALIDATE_URL)) {
echo "Crawling $crawlurl, please wait this can take a few!
\n";
$crawl = crawl_page($crawlurl, $crawl_depth, $database);
if ($crawl == 3) {
echo "";
} else {
echo "$crawlurl added to database!";
}
} else {
echo "ERROR: Invalid URL format!";
}
}
else if(isset($_GET['about']))
{
echo "
About seed
\n";
echo "
Seed is the most simple yet most secure, non-tracking, open source search engine primarily around the free and open source community!"
. " Building a search engine database requires resources, and lots of crawling! Help us out in providing us with some helpful links used to"
. " add content to our database!
";
}
else if(isset($_GET['submit']))
{
echo "
Submit a URL into the seed
\n";
echo "By submitting a URL into seed's web crawler prompt, you acknowledge that you're authorizing us to crawl the given link!
";
echo "
";
}
else
{
?>