使用注意:
修改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:[email protected] */ //=================================================== header("content-type:text/html; charset=gb2312"); //站點日志目錄,注意該目錄必須要有站點用戶讀取權限! //如果把日志下載到本地請修改143行的網址為您網站的網址,此操作不是必要操作,不影響分析結果。 //如果修改了文件名稱iis.php 需要同時修改代碼 ctrl+h 把 iis.php全部替換成您要修改的文件名 否則程序運行出錯。 $folder="d:/vhost/webroot/jooker82465/www/wordpress/uploads/w3svc87164023/"; //后面記得一定要帶斜杠 / ! $pagesize = 50;//設置分頁顯示條數! //========================= $type = addslashes($_get[’type’]); if ($type)$type = base64_decode($type); $showfile = addslashes($_get[’showfile’]); $page = addslashes($_get[’page’]); if (!$page)$page=1; //============================ //打開目錄 if (!$type){ if (file_exists($folder)) { $fp=opendir($folder); while(false!=$file=readdir($fp)) { if($file!=’.’ &&$file!=’..’) { $file="$file"; $arr_file[]=$file; } } if(is_array($arr_file)) { for ($i=count($arr_file)-1;$i>=0;$i--) { $indexstr.=" <tr><td height=/"25/" width=/"10%/">".date("y-m-d",filectime($folder.$arr_file[$i]))."</td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(baiduspider)."&showfile=".$arr_file[$i]."/">百度(baidu)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(googlebot)."&showfile=".$arr_file[$i]."/">谷歌(google)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(yahoo)."&showfile=".$arr_file[$i]."/">雅虎(yahoo)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(yodaobot)."&showfile=".$arr_file[$i]."/">有道(yodao)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(sosospider)."&showfile=".$arr_file[$i]."/">搜搜(soso)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(sogou)."&showfile=".$arr_file[$i]."/">搜狗(sogou)</a></td> <td height=/"25/" width=/"10%/" align=/"center/"> <a href=/"iis.php?type=".base64_encode(msnbot)."&showfile=".$arr_file[$i]."/">微軟(msn)</a></td> </tr>"; } } closedir($fp); $html = indexhtml(); $copy = mycopy(); $html = str_replace("[showlog]",$indexstr,$html); $html = str_replace("[copy]",$copy,$html); echo $html; }else{ echo "該日志目錄不存在或權限不足,請檢查設置!"; exit(); } }elseif ($type==’baiduspider’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’googlebot’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’yahoo’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’yodaobot’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’sosospider’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’sogou’){ echo show($type,$folder,$showfile,$page,$pagesize); }elseif ($type==’msnbot’){ echo show($type,$folder,$showfile,$page,$pagesize); } function show($type,$folder,$showfile,$page,$pagesize) { if ($type==’baiduspider’) { $title=’百度’; }elseif ($type==’googlebot’){ $title=’谷歌’; }elseif ($type==’yahoo’){ $title=’雅虎’; }elseif ($type==’yodaobot’){ $title=’有道’; }elseif ($type==’sosospider’){ $title=’搜搜’; }elseif ($type==’sogou’){ $title=’搜狗’; }elseif ($type==’msnbot’){ $title=’msn’; } if ($type&&$folder&&$showfile) { if(file_exists($folder.$showfile)) { $fp= fopen($folder.$showfile,"r"); }else{ echo "該日志文件不存在,請檢查設置!"; exit; } $j=0; $y=0; $t=0; $h=0; while (!feof($fp)) { $str = fgets($fp); $str =iconv("utf-8","gb2312//ignore",$str); if(strpos($str,$type)) { $j++; $temp[].=$str; $tmpcount = explode(" ",$str); if ($tmpcount[11]==200)$t++; if ($tmpcount[11]==304)$h++; if ($tmpcount[11]==404)$y++; } } fclose($fp); $count = count($temp); if ($page==1) { $countshow=$count; $mynum = $count-$pagesize; }else{ $countshow =$count-($page*$pagesize-$pagesize); $mynum = $count-$page*$pagesize; } $pagecount =ceil(count($temp) / $pagesize); if ($page>=$pagecount) { $mynum = $pagecount; } $m=0; for ($i=$countshow-1;$i>=$mynum;$i--) { $num = explode(" ",$temp[$i]); $domain="http://tarr.cn"; //網站url 末尾不要帶斜杠 $show.=" <tr onmouseout=/"this.style.backgroundcolor=’#ffffff’/" onmouseover=/"this.style.backgroundcolor=’#f6f6f6’/"> <td class=/"c/" width=/"200;/">".$num[0]." ".$num[1]."</td> <td class=/"c/">".$num[9]."</td> <td class=/"pl/"><a href=/"$domain$num[5]/" _fcksavedurl="/"$domain$num[5]/"" target=/"_blank/">".$num[5]."</a></td> <td class=/"c/">".$num[11]."</td> </tr>"; } unset($temp); $showpage = "<td colspan=/"4/" height=/"30/" align=/"center/">每頁 ".$pagesize." 條 當前".$page."/$pagecount"; $showpage.=" <a href=/"?type=".base64_encode($type)."&showfile=".$showfile."/">首頁</a>"; if ($page!=1) { $showpage.=" <a href=/"?type=".base64_encode($type)."&showfile=".$showfile."&page=".($page-1)."/">上一頁</a>"; } if ($page!=$pagecount) { $showpage.=" <a href=/"?type=".base64_encode($type)."&showfile=".$showfile."&page=".($page+1)."/">下一頁</a>"; $weei = " <a href=/"?type=".base64_encode($type)."&showfile=".$showfile."&page=".($pagecount)."/">尾頁</a>"; } $showpage.=$weei."</td>"; if ($show) { $html = pagehtml(); $copy = mycopy(); $htmltitle = "牛仔iis日志蜘蛛爬行記錄分析器 茄咧啡修改版";//請保留,謝謝! $html = str_replace("[title]",$title,$html); $html = str_replace("[htmltitle]",$htmltitle,$html); $html = str_replace("[show]",$show,$html); $html = str_replace("[count]",$j,$html); $html = str_replace("[page]",$showpage,$html); $html = str_replace("[y]",$y,$html); $html = str_replace("[t]",$t,$html); $html = str_replace("[h]",$h,$html); $html = str_replace("[copy]",$copy,$html); return $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" > <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" height="74"> <tr> <td><a href="iis.php">返回日志目錄</a> | <a >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> [page] </tr> </table> [copy] </body> </html>’; } function mycopy() { return ’<table border="1" width="100%" id="table2" cellspacing="0" cellpadding="0" 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" >茄咧啡</a></p> <p>*******************************************************</p> <p> 原程序名稱:<a target="_blank" >牛仔iis日志蜘蛛爬行記錄分析器</a></p> <p> 原作者:牛仔</p> <p> qq:172379201</p> <p> email:17gd$163.com ($轉換@)</p> <p> 注意:本程序只供大家學習使用,請勿用作商業用途。</p> </tr> </table>’; } ?> |
新聞熱點
疑難解答
圖片精選