⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check_links.php

📁 ·IP地理位置查询系统 v1.0 ·手机归属地查询 ·9om极品网站自助链接 ·google全站搜索php程序1101.net版 ·仿google搜索引擎 v3.0 ·珊瑚虫google搜索
💻 PHP
字号:
<?php
$max_allow_links = 100; // 最大许可检查的链接数目

// 此函数转载于www.lian123.com,特别鸣谢
function my_file_get_contents($url, $timeout=30)	{
	if ( function_exists('curl_init') )	{
		$ch = curl_init();
		curl_setopt ($ch, CURLOPT_URL, $url);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
		$file_contents = curl_exec($ch);
		curl_close($ch);
	} else if ( ini_get('allow_url_fopen') == 1 || strtolower(ini_get('allow_url_fopen')) == 'on' )	{
		$file_contents = @file_get_contents($url);
	} else {
		$file_contents = '';
	}
	return $file_contents;
}

// 开始检查 
if( isset($_GET['mod']) && $_GET['mod'] == 'check_now' && isset($_GET['id']) && isset($_GET['my_url']) && isset($_GET['url']) && isset($_GET['auto_check']) ){
	$js_id = 'parent.document.getElementById("s_' . $_GET['id'] . '").innerHTML';
	if( strstr($_GET['url'],$_GET['my_url']) ) {
 		echo '<script>' . $js_id . ' = "内部链接";</script>';

	} else if( !stristr($_GET['url'],'http://') ) {
 		echo '<script>' . $js_id . ' = "错误链接";</script>';
	} else {
		$s = my_file_get_contents($_GET['url']);

		if( trim($s) == '' ){
			echo '<script>' . $js_id . ' = "抓取内容失败";</script>';
		} else 	if( stristr($s,$_GET['my_url']) ){
			echo '<script>' . $js_id . ' = "<font color=green>包含链接,检查通过</font>";</script>';
		} else {
			echo '<script>' . $js_id . ' = "<font color=red>没有找到链接,请核查</font>";</script>';
		}
	}

	if($_GET['auto_check']==1){
		echo '<script>parent.checkLink(' . ($_GET['id']+1) . ');</script>';
	}

	exit('<br />done!');
	
}
?>
<!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>
  <title>《做网站》友情链接自动检查程序</title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="www.zuowangzhang.com.cn" />
 
  <meta name="description" content="我们很BS这样的人,当时双方都交换了首页链接,但对方却随意取消和您交换的友情链接(即对方去掉您网站的链接,而您却还保留了它的链接)有了本程序,您可以快速、自动的检查您的友情链接网址,查看对方的网站是否去掉了您的链接。" />
 <style>
body,td{font-size:9pt;font-family:arial;}
a:link,a:visited{color:blue;}
a:hover{color:red;}

A.black:link,A.black:visited{color:black;text-decoration: none;}

.main_tb {width:580px;}
.main_tb .tb_title {background-color: #CCFFFF;}
.main_tb .tr_title {background-color: #A6D9D2;height:40px;}

</style>
<base target=_blank></base>
 </head>

 <body>
<iframe src="about:blank" width=0  height=0 name="hidden_iframe" id="hidden_iframe"></iframe>

<script type="text/javascript">
<!--
my_url = '';
checking_str = "正在检查...";
check_time_out = 25000;
auto_check = 0;


function checkZuoWangZhang()	{
	var all_code = window.frames["zuoWangZhang.com.cn"].document.body.innerHTML;
	if(all_code.indexOf('http://') ==-1){
		alert("请直接将您网站的文字和图片链接复制Ctrl+c,粘贴Ctrl+v进来 ");
		return false;
	}
	if(f.my_url.value.indexOf('.') ==-1){
		alert("请输入您的网站首页地址");
		return false;
	}

	if(f.my_url.value.indexOf('http://') ==-1){
		f.my_url.value = 'http://' + f.my_url.value;
	}

	if( f.my_url.value.substr(f.my_url.value.length-1,1) == '/' )	{
		f.my_url.value = f.my_url.value.substr(0,f.my_url.value.length-1);
	}

	f.html_code.value = all_code;
	return true;
}

function checkTimeout(id)	{
	if(document.getElementById('s_'+id).innerHTML!=checking_str){
		return false;
	}
	document.getElementById('s_'+id).innerHTML = "可能超时,<a href='#' onclick='return checkLink("+id+");'>重新检查</a>";

	if(auto_check==1){
		checkLink((id+1));
	}
	return true;
}

function checkLink(id)	{
	if(document.getElementById('s_'+id)==null){
		auto_check = 0;
		return false;
	}
	if( auto_check==1 && document.getElementById('s_'+id).innerHTML.indexOf('超时')!=-1 ){
		alert("请等自动检查全部结束以后,再进行操作!");
		return false;
	}
	document.getElementById('hidden_iframe').src = 'check_links.php?mod=check_now&url=' + escape(document.getElementById('u_'+id).href) + '&id=' + id + '&my_url='+ escape(my_url) + '&auto_check=' + auto_check + '';

	document.getElementById('s_'+id).innerHTML = checking_str;

	setTimeout("checkTimeout("+id+")",check_time_out);

	return false;
}

function autoCheckLink(id)	{
	checkLink(id);
	//setTimeout("checkLink("+(id+1)+")",(check_time_out+1000));
}
//-->
</script>



<center>
<h4>友情链接自动检查程序</h4>
我们很BS这样的人,当时双方都交换了首页链接,但对方却随意取消和您交换的友情链接(即对方去掉您网站的链接,而您却还保留了它的链接)
<br />&nbsp;<br />
有了本程序,您可以快速、自动的检查您的友情链接网址,查看对方的网站是否去掉了您的链接。

<br />

<?php

// 显示获取到的链接地址
if( isset($_POST['html_code']) && isset($_POST['my_url']) ){
 
	preg_match_all("/<a[\s\t\r\n]{1,}[^<]{0,}href=[\"']{0,}(https?:\/\/.*)[\s\t\r\n\"'\>]{1,}/isU",stripslashes($_POST['html_code']),$ary);

	if( isset($ary[1]) && count($ary[1])>0 ){
		echo '<table bordercolordark="#ffffff" align="center" bordercolorlight="#000000" border="1"  cellspacing="0" cellpadding="4" class=main_tb><tr><td colspan=10 class=tb_title> <font size="4" ><b>开始检查</b></font> 
		<br />
			检查下列网址是否包含有 <font color=green>' . $_POST['my_url'] . '</font> 的链接
		</td></tr>
		<tr class=tr_title>
			<td>序号</td>
			<td align=left>被检查的网址</td>
			<td >检查结果</td>
			</tr>
		';
		for($i=0; $i<count($ary[1]); $i++){
			
			$check_str = ($_POST['auto_check']==0) ? '<a href="#" onclick="return checkLink(' . $i . ');">开始检查</a>' : '<font color=gray>等待中...</font>';

			echo '<tr>
			<td>' . ($i+1) . '.</td>
			<td align=left><a href="' . $ary[1][$i] . '" id=u_' . $i . '  target=_blank>' . $ary[1][$i] . '</a></td>
			<td id=s_' . $i . '>' . $check_str . '</td>
			</tr>';

			if($i>$max_allow_links){
				break;
			}
		}
		echo '</table>';
	}
	echo '<script>my_url="' . trim($_POST['my_url']) . '";auto_check=' . (int)$_POST['auto_check'] . ';</script>';

	if( $_POST['auto_check']==1 ){
		echo '<script>autoCheckLink(0);</script>';
	}
	
}

?>
 

<form method="post" action="check_links.php" name="formZuoWangZhang" target=_top>

必须包含地址(自己网站首页):<input type="text" name="my_url" size=50 value="<?php if(isset($_POST['my_url'])){echo $_POST['my_url'];}?>" />
<br />
自动或手工检查:<select name="auto_check"><option value=1>自动</option><option value=0>手工</option></select>
<br />&nbsp;<br />
要检查的网站(下面是可视化输入框,请直接将文字链接和图片链接复制,粘贴 到下面即可):<br />
<iframe id="zuoWangZhang.com.cn" name="zuoWangZhang.com.cn" height="150" width="600" style="padding:0px;"></iframe> 
<script>window.frames["zuoWangZhang.com.cn"].document.designMode="On";</script>



<br />&nbsp;<br />
<input type="hidden" name="html_code" />



<table width=600>
	<tr>
		<td width=100 align=center>&nbsp;</td>
		<td width=400 align=center><input type="submit" onclick="return checkZuoWangZhang();" value="  开始检查  " /></td>
		<td width=100 align=right><a href=# onclick="return setTestLinks(this);">载入测试数据</a>
</td>
	</tr>
</table>
 
<br />&nbsp;<br />

如果您不知道怎么开始,请点击 <a href=# onclick="return setTestLinks(this);">载入测试数据</a>,然后点击 <input type="submit" onclick="return checkZuoWangZhang();" value="开始检查" style="height:19px;" /> 查看演示

<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />

<!-- 欢迎转载,但请保留下面的文字和链接,修改链接会被BS,谢谢合作 -->

本程序由《<A HREF="http://www.ZuoWangZhanG.com.cn/" class=black>做网站</a>》原创,完全开源!<a href="http://www.zuowangzhang.com.cn/download/check_links.zip">下载</a>
<br />&nbsp;<br />欢迎各位转载,但请保留<A HREF="http://www.ZuoWangZhang.com.cn/ZuoWangZhan/RuHeZuoWangZhan/"  class=black>如何做网站</a>的文字,谢谢!

<br />&nbsp;<br />

欢迎您 <a href="http://www.zuowangzhang.com.cn/hbcms/user/add_msg.php?to_user_id=1&to_user_name=网站管理员" target=_blank>给作者提出反馈意见</a>,我会不断的改善它,推出更好用的版本。

</form>
<script type="text/javascript">
f = document.formZuoWangZhang;
</script>


</center> 

<?php 
if(isset($_POST['html_code'])){
	echo '
	<div id=old_links style="display:none;">
	' . stripslashes($_POST['html_code']) . '
	</div>
	<script type="text/javascript">

	function setOldLinks()	{

		window.frames["zuoWangZhang.com.cn"].document.body.innerHTML = document.getElementById("old_links").innerHTML;
		document.getElementById("old_links").innerHTML = "";
	}
	setTimeout("setOldLinks()",3000);

	</script>';
	
}
	
?>


<p>&nbsp;</p>












<span id=test_links>

<TABLE align=center  cellpadding='1' cellspacing='0' style="font-size:9pt;">
<TR >
	<TD colspan="6">
我的友情连接:
</td><TD colspan=2>
<div align=right> 
</td></tr><tr>
<!-- 文字链接 -->
	<td>
	<A HREF="http://www.hao123.com/">Hao123
	</td>
			<td>
	<A HREF="http://www.265.com/">265
	</td>
			<td>
	<A HREF="http://site.baidu.com/">百度网址
	</td>
			<td>
	<A HREF="http://www.zuoWANGZHANG.com.cn/">建网站</a>
	</td>
			<td>
	<a class="l" href="http://site.yahoo.com.cn/" target="_blank">雅虎网址</a>
 
	</td>
			<td>
	<A HREF="http://www.baidu.com/">baidu
	</td>

			<td>
<a  href="http://daohang.google.cn/" target="_blank">Google导航</a>
	</td>		
		</tr> 

<!-- 图片链接 -->
<tr>

 
			<td>
	<A HREF="http://www.lian123.com/"><img src="http://cn.yimg.com/sp/yahoohp060323/logo_yahoo.gif" width=88 height=31 border=0  ></A>
	</td>
			<td>
	<A HREF="http://www.yisou.com/"><img src="http://static.php.net/www.php.net/images/logos/php-power-white.gif" width=88 height=31 border=0 ></A>
	</td>
			<td>
	<A HREF="http://www.google.cn/"><img src="http://www.mysql.com/common/logos/mysql_100x52-64.gif" width=88 height=31 border=0  ></A>
	</td>
	<td>
 
			<td>
	<A HREF="http://www.jipiaojiage.cn/"><img src="http://image2.sina.com.cn/home/images/sina_logo2.gif" width=88 height=31 border=0  ></A>
	</td>
			<td>
	<A HREF="http://www.google.com/"><img src="http://www.google.com/logos/lunarnewyear03.gif" width=88 height=31 border=0 alt="谷歌Google"></A>
	</td>
		<td>
	<a class="l"   href="http://123.sogou.com/" target="_blank">搜狗网址</a>
	</td>
		</tr> 
		<tr><td colspan=10>
其他测试链接:
<a href="http://www.163.com/">163内部链接测试</a>
		</td></tr>
</TABLE>



</span>


<script type="text/javascript">
<!--

document.write('<sty'+'le>#te'+'st_li'+'nks {disp'+'lay:no'+'ne;}</sty'+'le>');
function setTestLinks(t)	{
	window.frames["zuoWangZhang.com.cn"].document.body.innerHTML = document.getElementById('test_links').innerHTML;

	document.getElementById('test_links').innerHTML = '';

	f.my_url.value = 'http://www.163.com/';
	return false;
}

 
	
	
//-->
</script>






</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -