function triggerAnotherSpider() { return false; //echo "#"; //echo "<br>'sp.lock' ";var_dump($_SESSION["searchConfig"]["sp.lock"]);echo "<br>'sp.cron' ";var_dump($_SESSION["searchConfig"]["sp.cron"]);echo "<br>'sp.interval' ";var_dump($_SESSION["searchConfig"]["sp.interval"]);echo "<br>'sp.time' ";var_dump($_SESSION["searchConfig"]["sp.time"]);echo "<br>'sp.pathto' ";var_dump($_SESSION["searchConfig"]["sp.pathto"]);echo "<br>'s.spkey' ";var_dump($_SESSION["searchConfig"]["s.spkey"]); if ((!isset($_SERVER["HTTP_USER_AGENT"]) || $_SERVER["HTTP_USER_AGENT"] != SEARCH_UA_NAME) && $_SESSION["searchConfig"]["sp.lock"] == "false" && $_SESSION["searchConfig"]["sp.cron"] == "false" && $_SESSION["searchConfig"]["sp.interval"] && $_SESSION["searchConfig"]["sp.time"] < time() - $_SESSION["searchConfig"]["sp.interval"] * 3600) { $rpage = new OS_Fetcher($_SESSION["searchConfig"]["sp.pathto"]); $rpage->request = "HEAD"; $rpage->accept = array("text/html", "application/xhtml+xml", "text/xml"); $rpage->fetch(); //echo "*"; //TODO: error message "Incorrect key to initiate spider", so no respidering done... if (count(preg_grep("/^Orcascript: Search_Spider/", $rpage->headers))) { //echo "+"; $this->setData("s.spkey", md5(time())); $conn2 = pfsockopen($rpage->parsed["realhost"], $rpage->parsed["port"], $erstr, $errno, 5); @fwrite($conn2, "GET " . $rpage->parsed["path"] . "?key=" . $_SESSION["searchConfig"]["s.spkey"] . " HTTP/1.0\r\n" . "Host: " . $rpage->parsed["hostport"] . "\r\n" . "User-Agent: " . SEARCH_UA_NAME . "\r\n" . "Referer: http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "\r\n" . "\r\n"); } } }
if (time() > $GLOBALS["VDATA"]['s.cachetime']) { list($_CDATA['scount']) = mysql_fetch_array(mysql_query("SELECT SUM(`hits`) FROM `{$_DDATA['tablestat']}`;", $_DDATA['link'])); $_CDATA['sperhour'] = $_CDATA['scount'] * 3600 / (time() - $GLOBALS["VDATA"]['s.cachetime']); } else { $_CDATA['sperhour'] = 0; } list($_CDATA['sravg']) = mysql_fetch_array(mysql_query("SELECT AVG(`results`) FROM `{$_DDATA['tablestat']}`;", $_DDATA['link'])); } break; case "Spider": /* ******************************************** */ OS_setData("c.spkey", md5(time())); $_CDATA['snf'] = true; $_CDATA['ser'] = true; if ($GLOBALS["VDATA"]['sp.pathto'] != "http://") { $spage = new OS_Fetcher($GLOBALS["VDATA"]['sp.pathto']); $spage->request = "HEAD"; $spage->accept = array("text/html", "application/xhtml+xml", "text/xml"); $spage->fetch(); if (!$spage->errstr) { if ($spage->httpcode[0] == "2") { $_CDATA['snf'] = false; } if (count(preg_grep("/^Orcascript: Search_Spider/", $spage->headers))) { $_CDATA['ser'] = false; } } } $_CDATA['cronsp'] = parse_url($GLOBALS["VDATA"]['sp.pathto']); list($_CDATA['indexpages']) = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `{$_DDATA['tablename']}` WHERE `body`!='';", $_DDATA['link'])); list($_CDATA['utf8pages']) = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `{$_DDATA['tablename']}` WHERE `encoding`='UTF-8' AND `body`!='';", $_DDATA['link']));