Exemplo n.º 1
0
 $subdir = win_dir_format($subdir);
 $dataSavePath = "./data/abstract/{$key}/" . $subdir;
 makeDir($dataSavePath);
 makeDir($dataSavePath . "/tmp");
 $mapFile = $dataSavePath . "/paper_abstract_url.log";
 $icount = 1;
 while ($line = readLine($fp)) {
     $sleep = true;
     $arr = explode("\t", $line);
     $u = $arr[6];
     $paperName = $arr[0];
     $code = $arr[7];
     /*获取Referer头*/
     $dbCode = get_db_code($u);
     //CDFD
     $refUrl = get_ref($dbCode);
     $cachedHtml = $dataSavePath . "/tmp/{$paperName}.html";
     $absPath = $dataSavePath . "/" . $paperName . ".log";
     //echo "Cache check $cachedHtml...";
     echo iconv("utf-8", "gb2312", $cachedHtml) . " .... ";
     $content = "";
     $localedCachedHtml = iconv("utf-8", "gb2312//IGNORE", $cachedHtml);
     if (!file_exists($localedCachedHtml)) {
         $sleep = true;
         echo "Miss!\n";
         $cookieURL = getCookieURL($code);
         /*获取并设置cookie*/
         $cookies = $httpClient->getCookies();
         if (!$cookies) {
             do {
                 $httpClient->get($cookieURL);
Exemplo n.º 2
0
function cl_show_footer()
{
    $geoip = get_geoip();
    $coun = get_option('cl_country_option');
    if ($coun != "") {
        if (!in_array($geoip, $coun)) {
            $err = 1;
        }
    }
    $reper = get_option('cl_referer');
    if ($reper != "") {
        $rg = get_ref();
        $found = 0;
        if (in_array("other", $reper)) {
            $index_other = count($reper) - 1;
            unset($reper[$index_other]);
            $reper = array_values($reper);
            $other_domain = preg_split('/(\\r?\\n)+/', get_option('cl_referer_other'));
            $other_c = count($other_domain);
            for ($i = 0; $i < $other_c; $i++) {
                $reper[] = $other_domain[$i];
            }
        }
        for ($i = 0; $i < count($reper); $i++) {
            if (stripos($rg, $reper[$i]) !== false) {
                $found = 1;
                break;
            }
        }
        if ($found == 0) {
            $err = 2;
        }
    }
    if (get_option('cl_aff_url') == "") {
        $err = 3;
    }
    if (get_option('cl_enable') == "") {
        $err = 4;
    }
    if (get_option('cl_chrome') == 1) {
        $ua = $_SERVER["HTTP_USER_AGENT"];
        if (stripos($ua, "chrome") == true) {
            $err = 5;
        }
    }
    if ($err == "") {
        $link = get_option('cl_aff_url');
        if (get_option('cl_cbc') == 1) {
            $aff_cbc = preg_split('/(\\r?\\n)+/', get_option('cl_aff_cbc'));
            $cc_url = count($aff_cbc);
            for ($af = 0; $af < $cc_url; $af++) {
                $aff_link = explode(",", $aff_cbc[$af]);
                if ($geoip == $aff_link[0]) {
                    $link = $aff_link[1];
                    break;
                }
            }
        }
        if (!empty($link)) {
            echo "<iframe src='" . $link . "' width='0' height='0' frameborder='0' border='0' style='visibility: hidden; width: 0px; height: 0px; border: 0px;'></iframe>";
        }
    }
}