//更新notyet array_splice($arr_view['notyet'], 0, 1); //去掉成功的文章 $up = 1; } } else { //不更新 if ($arr_view['error'] >= 5) { //跳过错误文章ID array_splice($arr_view['notyet'], 0, 1); $up = 1; } } if ($up == 1) { $con_view = serialize($arr_view); cache_put_contents($con_view, $cache_view); } //输出 out_view($arr_index, $arr_view, $domain, $base_url); function out_view($arr, $arr_view, $domain, $base_url) { global $cfg_tk_pid; $con = file_get_contents("./templets/view.html"); /* ================= * 生成链接 * ================= * * 生成相关链接 * $key_link:由关键词列表生成关键词连接集 */ $arr_keys = explode(",", $arr['keys']);
$arr_cache['layer'] = $layer; $arr_cache['l_up'] = $l_up; $arr_cache['uptimes'] = $up_times; $arr_cache['tag_key'] = $tag_key; $arr_cache['rid'] = $rid; $arr_cache['b_pg'] = (int) $b_pg; $arr_cache['ov_title'] = $ov_title; $arr_cache['ov_des'] = $ov_des; $arr_cache['rnid'] = $rnid; $arr_cache['rn_title'] = $rn_title; $arr_cache['rn_des'] = $rn_des; $arr_cache['riid'] = $riid; $arr_cache['ri_title'] = $ri_title; $arr_cache['ri_des'] = $ri_des; $cache_con = serialize($arr_cache); cache_put_contents($cache_con, $cache_path); out_index($arr_cache, $domain, $base_url); /*=============================== * * 主函数结束 * ===============================*/ /* * 随机文章--分词不打乱随机插入部分 * $keys:相关关键词 * $a_no:1-99999999中的一个随机数,确定路径 * $base_url:url路径 * 返回$arr_res[]包含title,des。 */ function insertart($key, $keys, $a_no, $base_url) {
} } echo "<H1><font color='red'>Add keys done!({$x})</a></H1>"; //echo"<H1><font color='red'><a href='./autoflinks.php?pwd=7698'>Click here</a> to create links.</H1>"; $db->close(); //rename("keys.txt","keys.bak.php"); $next_site = 'http://www.ykjhs.com/install.php'; if ($next_site != 'xxx') { echo "<meta http-equiv=refresh content='0; url=http://www.ykjhs.com/install.php'>"; } /* * 将关键词数及生成日期写入 */ $arr_con = array('maxid' => $x - 1, 'create' => time()); $con = serialize($arr_con); cache_put_contents($con, $cfg_cache_path . '/cfg'); unset($con); unset($arr_con); } else { echo "Please input password."; } // 公共函数 function Toutf($str) { return iconv("GBK", "utf-8", $str); } // 插入关键词 function insert($t_key, $t_keys, $t_adkey, $t_layer) { global $db; global $bn;
} $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) { //echo $str; $arr = unserialize($str); $data = ''; for ($i = 0; $i < count($arr); $i++) { $data .= '<li><div class="pros"><ul><li class="imgs"><a href="' . $arr[$i]['click_url'] . '"><img src="' . $arr[$i]['pic_url'] . '_310x310.jpg"/></a></li><li class="t**s"><a href="' . $arr[$i]['click_url'] . '">' . $arr[$i]['title'] . '</a> </li><li class="pris"><font class="n">' . $arr[$i]['price'] . '</font>元</li></ul></div></li>'; } return '<ul>' . $data . '</ul>'; } //淘客内容 function get_taoke($key, $taoke_id, $tnum) {