欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php實(shí)現(xiàn)首頁(yè)鏈接查詢 友情鏈接檢查的代碼

 更新時(shí)間:2010年01月05日 23:25:12   作者:  
網(wǎng)站首頁(yè)超鏈接反查 友情鏈接查詢 外鏈查詢 ,對(duì)于其中的思路
復(fù)制代碼 代碼如下:

<?php
/*
* 網(wǎng)站首頁(yè)超鏈接反查 友情鏈接查詢 外鏈查詢
* web技術(shù)愛(ài)好者 lost63.com原創(chuàng) QQ:35501547
* 轉(zhuǎn)載請(qǐng)注明出處
*/

if($_GET['action']=="check"){

$domain=$_POST['domain'];

//域名表單項(xiàng)為空,則獲取地址欄參數(shù)
if($domain==""){
$domain=$_GET['domain'];
}

//網(wǎng)址
$url="http://".$domain;

//讀取網(wǎng)頁(yè),返回網(wǎng)頁(yè)源文件內(nèi)容
function read_url($str){

$file=fopen($str,"r") or die($str.'->遠(yuǎn)程網(wǎng)址讀取失敗! <a href="?next='.($_GET['next']+1).'&action=check&domain='.$_GET['domain'].'">點(diǎn)擊繼續(xù)查詢</a><br>');
while(!feof($file)){
$result.=fgets($file,9999);
}
fclose($file);
return $result;

}

//打開session
session_start();

//如果$_SESSION['matches']沒(méi)有賦值就設(shè)置它;
if(!isset($_SESSION['matches'])){
$result=read_url($url);

preg_match_all('/<a(.*?)href="(http:\/\/.*?)"(.*?)>(.*?)<\/a>/i',$result,$matches);
$num=count($matches[2]);
for($i=0;$i<$num;$i++){
if(strpos($matches[2][$i],$domain)>0){
unset($matches[2][$i]);
}
}

$_SESSION['matches']=$matches[2];
}
//直接從session中取出包含網(wǎng)址數(shù)組;
$matches[2]=$_SESSION['matches'];

$n=count($matches[2]);

$next=0;
$next+=$_GET['next'];

$result=read_url($matches[2][$next]);

if(strpos($result,$domain)>0){
$value=$matches[2][$next].' <font color=green>true</font><br>';
}else{
$value=$matches[2][$next].' <font color=red>false</font><br>';
}
$values=$_COOKIE['check_result'].$value;
setcookie("check_result",$values,time()+3600);
echo $values;

if($next==$n){
echo "掃描結(jié)束!";
}else{
echo '<meta http-equiv="refresh" content="1;URL=?next='.($next+1).'&action=check&domain='.$domain.'" />';
}


}else{
//刪除cookies
setcookie("check_result","",time()-3600);
echo '<form name="form1" method="post" action="?action=check">
<input type="text" name="domain">
<input type="submit" name="Submit" value="提交">
<font color="red">*</font>輸入域名 如:jb51.net
</form>';
}
?>

相關(guān)文章

最新評(píng)論