Exemplo n.º 1
0
function AddAndUpdateUrl($url, $action)
{
    global $db;
    $spider = new spider();
    $spider->url($url);
    $title = $spider->title;
    $fulltxt = $spider->fulltxt(800);
    $keywords = $spider->keywords;
    $description = $spider->description;
    $pagesize = $spider->pagesize;
    $array = array('url' => $url, 'title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'updatetime' => time());
    if ($action == "add") {
        $db->insert("kuaso_links", $array);
    } elseif ($action == "update") {
        $db->update("kuaso_links", $array, "url='" . $url . "'");
    }
}
Exemplo n.º 2
0
function add_site($url)
{
    global $db;
    $row = $db->get_one("select * from ve123_links where url='" . $url . "'");
    if (empty($row)) {
        require_once PATH . "include/spider/spider_class.php";
        $spider = new spider();
        $spider->url($url);
        $title = $spider->title;
        $fulltxt = $spider->fulltxt(800);
        $keywords = $spider->keywords;
        $description = $spider->description;
        $pagesize = $spider->pagesize;
        $htmlcode = $spider->htmlcode;
        $array = array("url" => $url, "title" => $title, "fulltxt" => $fulltxt, "pagesize" => $pagesize, "keywords" => $keywords, "description" => $description, "updatetime" => time());
        $db->insert("ve123_links", $array);
    } else {
        $array = array("updatetime" => time());
        $db->update("ve123_links", $array, "url='" . $url . "'");
    }
}
Exemplo n.º 3
0
    if (empty($site)) {
        $array = array('url' => $url, 'spider_depth' => $config["spider_depth"], 'indexdate' => time(), 'addtime' => time());
        $db->insert("kuaso_sites", $array);
    }
    $site = $db->get_one("select * from kuaso_sites where url='{$url}'");
    if (!empty($site)) {
        $ip = ip();
        //$referer=$_SERVER['HTTP_REFERER'];
        $v = $db->get_one("select * from kuaso_stat_visitor where v_ip='" . $ip . "' and v_time>='" . (time() - 86400 * 1) . "'");
        if (empty($v)) {
            $array = array('v_time' => time(), 'v_ip' => $ip);
            $db->insert("kuaso_stat_visitor", $array);
            $db->query("update kuaso_sites set com_time='" . time() . "',com_count_ip=com_count_ip+1 where url='" . $url . "'");
        }
    }
    $site = $db->get_one("select * from kuaso_sites where url='{$url}'");
    if (!empty($site)) {
        $row = $db->get_one("select * from kuaso_links where url='" . $url . "'");
        if (empty($row)) {
            $spider = new spider();
            $spider->url($url);
            $title = $spider->title;
            $fulltxt = $spider->fulltxt(800);
            $keywords = $spider->keywords;
            $description = $spider->description;
            $pagesize = $spider->pagesize;
            $array = array('url' => $url, 'title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'updatetime' => time());
            $db->insert("kuaso_links", $array);
        }
    }
}
Exemplo n.º 4
0
function Update_link($url)
{
    global $db, $bug_url;
    $is_success = FALSE;
    $is_shoulu = FALSE;
    $spider = new spider();
    $spider->url($url);
    $title = $spider->title;
    $fulltxt = $spider->fulltxt(800);
    $pagesize = $spider->pagesize;
    $keywords = $spider->keywords;
    $htmlcode = $spider->htmlcode;
    $description = $spider->description;
    $site_url = GetSiteUrl($url);
    $site = $db->get_one("select * from ve123_sites where url='" . $site_url . "'");
    $site_id = $site["site_id"];
    echo $title;
    $array = array('title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'site_id' => $site_id);
    $db->query("update ve123_links set updatetime='" . time() . "' where url='" . $url . "'");
    if (!empty($title)) {
        $s = array();
        $s = explode("?", $title);
        if ($pagesize > 1 && count($s) < 2) {
            $domain = GetSiteUrl($url);
            $site = $db->get_one("select * from ve123_sites where url='" . $domain . "'");
            if (!empty($site)) {
                if (!empty($site["include_word"])) {
                    foreach (explode(",", $site["include_word"]) as $value) {
                        if (stristr($htmlcode, $value)) {
                            $include_num += 1;
                        }
                    }
                    if ($include_num <= 0) {
                        $is_shoulu = FALSE;
                    }
                } else {
                    $is_shoulu = TRUE;
                }
                if (!empty($site["not_include_word"])) {
                    foreach (explode(",", $site["not_include_word"]) as $value) {
                        if (stristr($htmlcode, $value)) {
                            $not_include_num += 1;
                        }
                    }
                    if ($not_include_num > 0) {
                        $is_shoulu = FALSE;
                    }
                }
            } else {
                $is_shoulu = TRUE;
            }
            if ($is_shoulu) {
                $db->update("ve123_links", $array, "url='" . $url . "'");
                //file_put_contents(PATH."k/www/".str_replace("http://","",$url.".html"),$htmlcode);
                $is_success = TRUE;
            }
        }
    }
    if (empty($bug_url)) {
        exit;
    }
    return $is_success;
}