Stupid search engine tricks

As a followup to my initial search engine array post, I’ve implemented a rather useless little utility, slightly building upon it.

For one of my test sites, rather than having a generic ‘nothing here’ page, I decided to redirect the user to search for a given string based upon their forage into my directory:

header(“location: ” . randomSearchString($_SERVER[“REDIRECT_URL”]));

function randomSearchString($findString) { $randNum = mt_rand(1, 8); $searchengine = array ( ‘1’ => ‘http://www.altavista.com/cgi-bin/query?pg=q&what=web&fmt=&q=’, ‘2’ => ‘http://www.everything2.com/index.pl?node=’, ‘3’ => ‘http://msxml.excite.com/info.xcite/search/web/’, ‘4’ => ‘http://www.google.com/search?q=’, ‘5’ => ‘http://hotbot.lycos.com/?SW=web&SM=MC&DC=10&DE=2&RG=NA&_v=2&MT=’, ‘6’ => ‘http://search.lycos.com/?npl=&query=’, ‘7’ => ‘http://dpxml.webcrawler.com/info.wbcrwl/search/web/’, ‘8’ => ‘http://search.yahoo.com/bin/search?p=’ ); return $searchengine[$randNum] . $findString;
}
?>

What this does is take the string returned by the webserver and run it through my simple subroutine, which has a choice of 8 different search engines. It pseudo-randomly chooses one, appending this to the search, then blind-forwards the user to that search engine with a properly formatted query to search for what was given (in this case, my directory), in hopes that they find whatever they think they are looking for. Simple, and kind of cute.