仓酷云

标题: PHP网页编程之IIS日记剖析搜刮引擎爬虫纪录法式 [打印本页]

作者: 透明    时间: 2015-2-3 23:53
标题: PHP网页编程之IIS日记剖析搜刮引擎爬虫纪录法式
告诉你了一个方式,但是缺少努力这一环节,那也是白搭。   利用注重:
  修正iis.php文件中iis日记的相对途径
  例如:$folder=”c:/windows/system32/logfiles/站点日记目次/”; //前面记得必定要带斜杠(/)。
  ( 用虚拟空间的不懂检查你的站点相对途径?上传个探针检查!
  直接检查法:http://站点域名/iis.php
  当地检查法:把日记下载到当地 http://127.0.0.1/iis.php )
  注重:
  //站点日记目次,注重该目次必需要有站点用户读取权限!
  //假如把日记下载到当地请修正143行的网址为您网站的网址,此操作不是需要操作,不影响剖析了局。
  //修正文件称号iis.php 需求同时修正对应代码 ctrl+h 把 iis.php全体交换成您要修正的文件名 不然法式运转失足。
  //假如iis日记文件过大,能够会招致法式超时!同时也不建议人人利用!


  以下是PHP源代码:
<?php
/*
  牛仔IIS日记蜘蛛匍匐纪录剖析器 V1.1(PHP GB2312 版)
  作者:牛仔
  QQ:172379201
  Email:17gd@163.com
*/
//===================================================
  header("content-type:text/html; charset=gb2312");
//站点日记目次,注重该目次必需要有站点用户读取权限!
//假如把日记下载到当地请修正143行的网址为您网站的网址,此操作不是需要操作,不影响剖析了局。
//假如修正了文件称号iis.php 需求同时修正代码 Ctrl+H 把 iis.php全体交换成您要修正的文件名 不然法式运转失足。
&#36;folder="D:/Vhost/WebRoot/jooker82465/www/wordpress/uploads/W3SVC87164023/";  //前面记得必定要带斜杠 / !
&#36;pagesize = 50;//设置分页显示条数!
//=========================
&#36;type = addslashes(&#36;_GET[’type’]);
if (&#36;type)&#36;type = base64_decode(&#36;type);
&#36;showfile = addslashes(&#36;_GET[’showfile’]);
&#36;page = addslashes(&#36;_GET[’page’]);
if (!&#36;page)&#36;page=1;
//============================
//翻开目次
if (!&#36;type){
if (file_exists(&#36;folder))
{
  &#36;fp=opendir(&#36;folder);
  while(false!=&#36;file=readdir(&#36;fp))
  {
     if(&#36;file!=’.’ &&&#36;file!=’..’)
     {
         &#36;file="&#36;file";
         &#36;arr_file[]=&#36;file;
        }
  }
  if(is_array(&#36;arr_file))
  {
   for (&#36;i=count(&#36;arr_file)-1;&#36;i>=0;&#36;i--)
   {
    &#36;indexstr.="
<tr><td height=\"25\" width=\"10%\">".date("Y-m-d",filectime(&#36;folder.&#36;arr_file[&#36;i]))."</td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(Baiduspider)."&showfile=".&#36;arr_file[&#36;i]."\">百度(Baidu)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(Googlebot)."&showfile=".&#36;arr_file[&#36;i]."\">谷歌(Google)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(yahoo)."&showfile=".&#36;arr_file[&#36;i]."\">雅虎(yahoo)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(YodaoBot)."&showfile=".&#36;arr_file[&#36;i]."\">有道(yodao)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(Sosospider)."&showfile=".&#36;arr_file[&#36;i]."\">搜搜(soso)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(Sogou)."&showfile=".&#36;arr_file[&#36;i]."\">搜狗(sogou)</a></td>
<td height=\"25\" width=\"10%\" align=\"center\">
<a href=\"iis.php?type=".base64_encode(msnbot)."&showfile=".&#36;arr_file[&#36;i]."\">微软(msn)</a></td>
</tr>";
   }
   }
closedir(&#36;fp);
&#36;html = indexhtml();
&#36;copy = mycopy();
&#36;html = str_replace("[showlog]",&#36;indexstr,&#36;html);
&#36;html = str_replace("[copy]",&#36;copy,&#36;html);
echo &#36;html;
}else{
  echo "该日记目次不存在或权限缺乏,请反省设置!";
  exit();
}
}elseif (&#36;type==’Baiduspider’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’Googlebot’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’yahoo’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’YodaoBot’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’Sosospider’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’Sogou’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}elseif (&#36;type==’msnbot’){
  echo show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize);
}

function show(&#36;type,&#36;folder,&#36;showfile,&#36;page,&#36;pagesize)
{
if (&#36;type==’Baiduspider’)
{
  &#36;title=’百度’;
}elseif (&#36;type==’Googlebot’){
  &#36;title=’谷歌’;
}elseif (&#36;type==’yahoo’){
  &#36;title=’雅虎’;
}elseif (&#36;type==’YodaoBot’){
  &#36;title=’有道’;
}elseif (&#36;type==’Sosospider’){
  &#36;title=’搜搜’;
}elseif (&#36;type==’Sogou’){
  &#36;title=’搜狗’;
}elseif (&#36;type==’msnbot’){
  &#36;title=’MSN’;
}
if (&#36;type&&&#36;folder&&&#36;showfile)
{
  if(file_exists(&#36;folder.&#36;showfile))
  {
  &#36;fp= fopen(&#36;folder.&#36;showfile,"r");
  }else{
   echo "该日记文件不存在,请反省设置!";
   exit;
  }
  &#36;j=0;
  &#36;y=0;
  &#36;t=0;
  &#36;h=0;
  while (!feof(&#36;fp))
  {
   &#36;str = fgets(&#36;fp);
    &#36;str =iconv("UTF-8","GB2312//IGNORE",&#36;str);
   if(strpos(&#36;str,&#36;type))
   {
    &#36;j++;
    &#36;temp[].=&#36;str;
    &#36;tmpcount = explode(" ",&#36;str);
    if (&#36;tmpcount[11]==200)&#36;t++;
    if (&#36;tmpcount[11]==304)&#36;h++;
    if (&#36;tmpcount[11]==404)&#36;y++;
   }
  }
  fclose(&#36;fp);
  &#36;count = count(&#36;temp);
  if (&#36;page==1)
  {
   &#36;countshow=&#36;count;
   &#36;mynum = &#36;count-&#36;pagesize;
  }else{
   &#36;countshow =&#36;count-(&#36;page*&#36;pagesize-&#36;pagesize);
   &#36;mynum = &#36;count-&#36;page*&#36;pagesize;
  }
  &#36;pagecount =ceil(count(&#36;temp) / &#36;pagesize);
  if (&#36;page>=&#36;pagecount)
  {
   &#36;mynum = &#36;pagecount;
  }
  &#36;m=0;
  for (&#36;i=&#36;countshow-1;&#36;i>=&#36;mynum;&#36;i--)
  {
   &#36;num = explode(" ",&#36;temp[&#36;i]);
            &#36;domain="http://tarr.cn"; //网站URL 末尾不要带斜杠
    &#36;show.="
<tr onMouseOut=\"this.style.backgroundColor=’#FFFFFF’\" onMouseOver=\"this.style.backgroundColor=’#F6F6F6’\">
<td class=\"c\" width=\"200;\">".&#36;num[0]." ".&#36;num[1]."</td>
<td class=\"c\">".&#36;num[9]."</td>
<td class=\"pl\"><a href=\"&#36;domain&#36;num[5]\" _fcksavedurl="\"&#36;domain&#36;num[5]\"" target=\"_blank\">".&#36;num[5]."</a></td>
<td class=\"c\">".&#36;num[11]."</td>
</tr>";
  }
  unset(&#36;temp);
  &#36;showpage = "<td colspan=\"4\" height=\"30\" align=\"center\">每页 ".&#36;pagesize." 条 以后".&#36;page."/&#36;pagecount";
  &#36;showpage.="  <a href=\"?type=".base64_encode(&#36;type)."&showfile=".&#36;showfile."\">首页</a>";
  if (&#36;page!=1)
  {
   &#36;showpage.="  <a href=\"?type=".base64_encode(&#36;type)."&showfile=".&#36;showfile."&page=".(&#36;page-1)."\">上一页</a>";
  }
  if (&#36;page!=&#36;pagecount)
  {
  &#36;showpage.="  <a href=\"?type=".base64_encode(&#36;type)."&showfile=".&#36;showfile."&page=".(&#36;page+1)."\">下一页</a>";
  &#36;weei = "  <a href=\"?type=".base64_encode(&#36;type)."&showfile=".&#36;showfile."&page=".(&#36;pagecount)."\">尾页</a>";
  }
  &#36;showpage.=&#36;weei."</td>";
  if (&#36;show)
  {
  &#36;html = pagehtml();
  &#36;copy = mycopy();
  &#36;htmltitle = "牛仔IIS日记蜘蛛匍匐纪录剖析器 茄咧啡修正版";//请保存,感谢!
  &#36;html = str_replace("[title]",&#36;title,&#36;html);
  &#36;html = str_replace("[htmltitle]",&#36;htmltitle,&#36;html);
  &#36;html = str_replace("[show]",&#36;show,&#36;html);
  &#36;html = str_replace("[count]",&#36;j,&#36;html);
  &#36;html = str_replace("",&#36;showpage,&#36;html);
  &#36;html = str_replace("[y]",&#36;y,&#36;html);
  &#36;html = str_replace("[t]",&#36;t,&#36;html);
  &#36;html = str_replace("[h]",&#36;h,&#36;html);
  &#36;html = str_replace("[copy]",&#36;copy,&#36;html);
  return &#36;html;
  }
}
}
function indexhtml()
{
return ’<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>牛仔IIS日记蜘蛛匍匐纪录剖析器 V1.1</title>
<style>
<!--
td{ font-size: 12px; font-family: serif; }
tr td p a:link,tr td p a:visited{
color:#000000;
text-decoration:none;
}
-->
</style>
</head>
<body>
<table border="1" width="100%" id="table1" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
<tr>
  <td colspan="8" bgcolor="#808080" height="30" align="center"><b>
  <font color="#FFFFFF" size="3">牛仔IIS日记蜘蛛匍匐纪录剖析器 茄咧啡修正版</font></b></td>
</tr>
<tr>
  <td height="25" align="center" width="260">日期</td>
  <td colspan="6" height="25" align="center">引擎</td>
</tr>
<tr>
  [showlog]
</tr>
</table>
[copy]
</body>
</html>’;
}
function pagehtml()//============显示模板,标签取代显示内容!
{
return  ’<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>[title]蜘蛛匍匐剖析 - [htmltitle]</title>
<style>
<!--
td {  
font-size: 12px ;
height:18px;
}
.c{
text-align:center;
}
.pl{
padding-left:15px;
}
tr td p a:link,tr td p a:visited{
color:#000000;
text-decoration:none;
}
-->
</style>
</head>
<body>
<table border="1" width="100%" id="table1" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="74">
<tr>
<td><a href="iis.php">前往日记目次</a> | <a href="http://www.dj965.com">dj965</a>
  <td colspan="3" bgcolor="#808080" height="30" align="center">
  <font color="#FFFFFF" size="3"><b>[title]蜘蛛匍匐剖析</b></font></td>
</tr>
  <tr>
  <td colspan="4" height="20" align="center">今天志[title]蜘蛛共匍匐 <b>[count]</b> 次,个中正常 <b>[t]</b> 个,逝世链 <b><font color="red">[y]</font></b> 个,缓存 <b>[h]</b> 个</td>
</tr>
<tr>
  <td align="center" width="200px;"><font color="#FF0000">工夫</font></td>
  <td align="center" width="150px;"><font color="#FF0000">蜘蛛IP</font></td>
  <td align="center"><font color="#FF0000">被爬URL</font></td>
  <td align="center" width="100px;"><font color="#FF0000">匍匐了局</font></td>
</tr>
[show]
<tr>
  
</tr>
</table>
[copy]
</body>
</html>’;
}
function mycopy()
{
return ’<table border="1" width="100%" id="table2" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="402">
<tr>
  <td height="35" bgcolor="#C0C0C0" align="center"><b>注备申明</b></td>
</tr>
<tr>
  <td height="170">
  <p> 正常:暗示该面页蜘蛛会见正常,并已下载。匍匐形态前往200。</p>
  <p> 逝世链:暗示蜘蛛会见的面页不存在或链接毛病,匍匐形态前往404。</p>
  <p> 缓存:暗示蜘蛛之前已爬过的面页且该面页未更新过,蜘蛛缓存区已存在该文件,不再下载该面页内容。匍匐形态前往304。</p>
  <p> 注重:蜘蛛爬过的面页纷歧定会放出来,由于蜘蛛爬归去的数据须经由引擎划定规矩挑选后才会放出来,至于具体请检查引擎收录匡助。</p>
  </td>
</tr>
<tr>
  <td>
  <p> 法式称号:<a target="_blank" href="http://tarr.cn/?p=23">牛仔IIS日记蜘蛛匍匐纪录剖析器 - 茄咧啡修正版</a> 修正者:<a href="http://www.tarr.cn/" target="_blank">茄咧啡</a></p>  
  <p>*******************************************************</p>
  <p> 原法式称号:<a target="_blank" href="http://www.niuzi.com/">牛仔IIS日记蜘蛛匍匐纪录剖析器</a></p>  
  <p> 原作者:牛仔</p>
  <p> QQ:172379201</p>
  <p> Email:17gd&#36;163.com (&#36;转换@)</p>
  <p> 注重:本法式只供人人进修利用,请勿用作贸易用处。</p>
</tr>
</table>’;
}
?>
然后大吼:别人可以,我为什么就不可以?(是不是有点阎罗教练的味道,默默的确是电影看多了,抽嘴巴是会痛的,各位其实明白这个道理了就行了)
作者: 海妖    时间: 2015-2-4 06:56
先学习php和mysql,还有css(html语言很简单)我认为现在的效果比以前的方法好。
作者: 活着的死人    时间: 2015-2-9 18:10
对于懒惰的朋友,我推荐php的集成环境xampp或者是wamp。这两个软件安装方便,使用简单。但是我还是强烈建议自己动手搭建开发环境。
作者: 精灵巫婆    时间: 2015-2-16 09:01
我学习了一段时间后,我发现效果并不好(估计是我自身的问题)。因为一个人的精力总是有限的,同时学习这么多,会导致每个的学习时间都得不到保证。
作者: admin    时间: 2015-3-5 02:56
做为1门年轻的语言,php一直很努力。
作者: 谁可相欹    时间: 2015-3-11 22:44
兴趣是最好的老师,百度是最好的词典。
作者: 仓酷云    时间: 2015-3-19 15:09
不禁又想起那些说php是草根语言的人,为什么认得差距这么大呢。
作者: 小魔女    时间: 2015-3-22 01:10
基础有没有对学习php没有太大区别,关键是兴趣。
作者: 变相怪杰    时间: 2015-3-25 09:52
当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,
作者: 若天明    时间: 2015-3-27 22:11
爱上php,他也会爱上你。
作者: 灵魂腐蚀    时间: 2015-4-7 15:08
当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,
作者: 再见西城    时间: 2015-4-15 13:37
学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql
作者: 深爱那片海    时间: 2015-4-16 21:11
建数据库表的时候,int型要输入长度的,其实是个摆设的输入几位都没影响的,只要大于4就行,囧。
作者: 若相依    时间: 2015-4-26 15:12
php里的数组为空的时候是不能拿来遍历的;(这个有点低级啊,不过我刚被这个边界问题墨迹了好长一会)
作者: 小女巫    时间: 2015-6-15 21:16
如果你可以写完像留言板这样的程序,那么你可以去一些别人的代码了,
作者: 简单生活    时间: 2015-6-16 09:10
写js我最烦的就是 ie 和 firefox下同样的代码 结果显示的结果千差万别,还是就是最好不要用遨游去调试,因为有时候遨游是禁用js的,有可能代码是争取结果被遨游折腾的认为是代码写错。
作者: 金色的骷髅    时间: 2015-6-20 21:24
当然这种网站的会员费就几十块钱。
作者: 只想知道    时间: 2015-7-2 18:25
最后祝愿,php会给你带来快乐的同时 你也会给他带来快乐。
作者: 老尸    时间: 2015-7-12 20:15
多看优秀程序员编写的代码,仔细理解他们解决问题的方法,对自身有很大的帮助。
作者: 飘灵儿    时间: 2015-7-27 00:33
本文当是我的笔记啦,遇到的问题随时填充




欢迎光临 仓酷云 (http://www.ckuyun.com/) Powered by Discuz! X3.2