Esempio n. 1
0
$arr_view = unserialize($con_view);
/*
 * 相关问答页
 * rid的范围是1-10,查看各问答页的cache文件是否存在即可
 * 由$x_path给出
 * $x_link:相关链接
 */
if ($arr_view['x_no'] < 9) {
    $x_link = '';
    $x_no = 0;
    for ($i = 1; $i <= 10; $i++) {
        if ($i == $rid) {
            continue;
        }
        //本页就不判定了
        $x_path = cache_get_path($epath . $i, $cfg_cache_path . 'view/');
        //缓存路径
        if (file_exists($x_path)) {
            $con_x = file_get_contents($x_path);
            $arr_x = unserialize($con_x);
            $x_link .= '<a href="http://' . $base_url . 'view-' . $i . '.html">' . $arr_x['atitle'] . '</a><br>';
            //相关问题
            $x_no++;
        }
    }
    $arr_view['x_link'] = $x_link;
    $arr_view['x_no'] = $x_no;
}
/*
 * 还有内容未完善,抓取。每次抓取一篇文章。
 * 每篇文章错误5次跳过
Esempio n. 2
0
//确定$path的值
$base_url = $ename . $domain . $path;
$epath = $ename . $path;
$cfg_dbqz = str_replace('.', '_', $domain) . '_';
//数据表前缀
ini_set("magic_quotes_runtime", 0);
/*
 * 随机文章--分词不打乱随机插入部分
 * cache路径:$base_url.'reads-'.$rnid
 * url路径:/path/reads-$rnid.html
 * $riid:随机1-9999999的数字,用以确定采用哪条数据,cache*
 * $ri_url:由$rnid获取cache路径
 * ri_title:输出标题*
 * ri_des:输出描述*
 */
$cache_index = cache_get_path($epath, $cfg_cache_path . 'index/');
//主页的缓存,必须要有,需要读取
if (!file_exists($cache_index)) {
    //缓存不存在。说明出错了。
    echo "参数错误或当前页不可用。url:" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . '请稍候再试' . md5($rnid);
    die;
}
/*
 * 读取参数
 * arr_index:主页的参数
 */
$con_index = file_get_contents($cache_index);
$arr_index = unserialize($con_index);
/*
 * 生成标题,正文部分
 */
Esempio n. 3
0
    if (count($bids) > 0) {
        $this_bid = implode(',', $bids);
        $this_atitle = strip_tags($titles[0]);
        shuffle($descriptions);
        $this_description = strip_tags(implode('<br>', $descriptions));
        $this_description = substr_utf8($this_description, 0, 500);
        /*
         * 写入
         */
        $arr_view_con = array();
        $arr_view_con['bid'] = $this_bid;
        $arr_view_con['notyet'] = $bids;
        $arr_view_con['atitle'] = $this_atitle;
        $arr_view_con['description'] = $this_description;
        $view_con = serialize($arr_view_con);
        cache_put_contents($view_con, cache_get_path($epath . $rid, $cfg_cache_path . 'view/'));
        $ov_title = $arr_view_con['atitle'];
        $ov_des = $arr_view_con['description'];
    } else {
        $error_view += 1;
    }
}
/*
 * 随机文章--分词打乱部分
 * cache路径:$base_url.'read-'.$rnid
 * url路径:/path/read-$rnid.html
 * $rnid:随机1-9999999的数字,用以确定采用哪条数据,cache*
 * $rn_url:由$rnid获取cache路径
 * rn_title:输出标题*
 * rn_des:输出描述*
 */
/**
 * 调用方式 <script src='/get_tk.php?id=xxxx'></script>
 * BY:SeoLei 未经允许 请勿公开提供下载
*/
if (isset($_GET['id'])) {
    $id = $_GET['id'];
} elseif (isset($_GET['k'])) {
    $id = $_GET['k'];
}
$key = urldecode($id);
if ($key == '') {
    $key = '丰胸';
}
$arr = explode('_', $key);
$key = $arr[0];
$filename = cache_get_path($key, $cfg_ad_path);
if (file_exists($filename)) {
    include $filename;
    die;
} else {
    $taobaoke = get_taoke($key, $taoke_pid, $tnum);
    $data = get_content($taobaoke);
    $data = str_replace('/', '\\/', $data);
    $data = str_replace("'", "\\'", $data);
    $data = "document.writeln('{$data}');";
    echo $data;
    $data .= "<?php if(time()-" . time() . ">{$cache_time}){unlink('{$cache_path}{$filename}');}?>";
    cache_put_contents($data, $filename);
}
//根据模板输出格式
function get_content($str)