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

📄 index.php

📁 PHP版的天气预报小偷程序
💻 PHP
字号:
<?php
$tqcity = "福清";//城市
$tqurl = "http://tq.cnfq.com/";//网址
$cjurl = "http://www.weather.com.cn/html/weather/101230111.shtml";//采集网址

$action = $_GET['a'];
$date = date( "Y-m-d",time());
$st = date("h",time());

if (!file_exists("data/".$date."_".$st.".php")){
	include( "function.php" );
	@$content = utf82gb(openfileremote($cjurl));
	preg_match_all( "/<div class=\"right[_]contenttopl\">(.*?)<dd>(.*?)<\\/a><\\/dd>(.*?)<dd>(.*?)<\\/a><\\/dd>(.*?)42x30\\/(.*?)\.gif(.*?)42x30\\/(.*?)\.gif(.*)<em><strong>(.*?)<\\/strong><\\/em>(.*)no[_]today\">(.*?)<\/em>(.*?)<em>(.*?)<\/em>(.*?)<\\/div>(.*?)c[_]1[_]2\" style=\"display[:] none\;\">(.*?)<div class=\"box[_]hist\">(.*?)<div class=\"fut_weather\" id=\"dd_0\">(.*?)\r\n[	]*<\\/div>\r\n[	]*<\\/div>(.*?)[)]<\\/h2>(.*?)<div class=\"right[_]content\">/s", $content, $matches1 );

	$patterns1 = array ("'<div.*>'","'<\\/div>'","'<dl><dd>'","'<p>(.*)</p>'","' class.*\"'","'\r\n[\s]*'","'<\\/dl><dl>'","'\\/m\\/i\\/indexer\\/'","'[_]s'");
	$replace1 = array ("","","<dd>","<dl><dt>$1</dt>","","","</dl>\r\n\t<dl>","./images/","");
	$patterns2 = array ("'fut[_]weatherbox7'","'h4'","'temp0([0-3])[_]dn'","'<a name=\"sk\">'","'\\/m\\/i\\/icon[_]weather\\/42x30\\/([nd])'","'\r\n[\s]*'","'div><div'","'<a href=\"http:\\/\\/www.weather.com.cn\\/static\\/html\\/legend.shtml\" target=\"_blank\">'","'</a>'","'&nbsp;&nbsp;'");
	$replace2 = array ("wbox","p","pts$1","","./images/b/$1","","div>\r\n\t<div","","","&nbsp;");

	//echo $matches1[2][0];//日出
	//echo $matches1[4][0];//日落
	//echo $matches1[6][0];//天气图夜
	//echo $matches1[8][0];//天气图日
	//echo $matches1[10][0];//天气
	//echo $matches1[12][0];//温度
	//echo $matches1[14][0];//风向
	//echo preg_replace($patterns1,$replace1,$matches1[17][0].$matches1[21][0]);//生活指数
	//echo preg_replace($patterns2,$replace2,$matches1[19][0]);//五日天气

	$mo = $matches1[10][0];
	if ($mo != ""){
		$tc .= "<div id=\"bo1\">\r\n\t<div class=\"todayt\">今天是<span id=\"Calendar\"></span><script language=\"JavaScript\">setCalendar();</script></div>";
		$tc .= "<div id=\"logo\"><a href=\"".$tqurl."\"><img src=\"./images/logo.gif\" border=0 alt=\"".$tqcity."市天气预报\" /></a></div>";
		$tc .= "<div class=\"todayw\"><p><img src=\"./images/b/".$matches1[6][0].".gif\" />"."&nbsp;<img src=\"./images/b/".$matches1[8][0].".gif\" /></p>";
		$tc .= "<h2>".$matches1[10][0]."</h2>";
		$tc .= "<h1>".$matches1[12][0]."</h2>";
		$tc .= "<p>".$matches1[14][0]."</p>";
		$tc .= "<p>日出时间:".$matches1[2][0]."</p>";
		$tc .= "<p>日落时间:".$matches1[4][0]."</p>";
		$tc .= "<p>(本页数据更新时间:".date("Y-m-d H:i:s").")</p></div>\r\n</div>\r\n\r\n";

		$tc .= "<div id=\"bo2\">\r\n\t<div class=\"bt\">最近六日".$tqcity."天气预报</div>\r\n\t";
		$tc .= preg_replace($patterns2,$replace2,$matches1[19][0]);
		$tc .= "\r\n</div>\r\n\r\n";
		$tc .= "<div class=\"clear\"></div>\r\n\r\n";

		$tc .= "<div id=\"bo3\">\r\n\t<div class=\"bt\">今日".$tqcity."生活指数</div>\r\n\t";
		$tc .= preg_replace($patterns1,$replace1,$matches1[17][0].$matches1[21][0]);
		$tc .= "\r\n</div>\r\n\r\n";
		$tc .= "<!-- Update:".date("Y-m-d H:i:s")." -->\r\n\r\n";

		$fp0 = fopen("data/".$date."_".$st.".php","w");//a+,w
		fwrite( $fp0, "");
		fclose( $fp0 );
		$fp1 = fopen("b.php","w");//a+,w
		fwrite( $fp1, $tc);
		fclose( $fp1 );
		$fp2 = fopen("a.php","w");//a+,w
		fwrite( $fp2, "document.write(\"<div style='font-size:14px;font-weight: bold;'><img width=21 height=15 src='".$tqurl."images/s/".$matches1[6][0].".gif' align='absmiddle' />"."&nbsp;<img width=21 height=15 src='".$tqurl."images/s/".$matches1[8][0].".gif' align='absmiddle' />&nbsp;".$tqcity."天气</div><div><a href='".$tqurl."' target='_blank' title='".$matches1[10][0]."&nbsp;&nbsp;".$matches1[12][0]."'>".$matches1[10][0]."&nbsp;&nbsp;".$matches1[12][0]."</a></div>\");\r\n//Update:".date( "Y-m-d H:i:s",time()));
		fclose( $fp2 );
	}
}

if ( $a == "today" ){
	require( "a.php" );
}else{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?= $tqcity ?>市天气预报</title>
<style>
* {margin:0;padding:0}
body{margin:2px 0px; font-size:12px;}
em, i{font-style: normal;}
ul{list-style-type:none}
a:link,a:visited{color:#194F95;text-decoration:none;}
a:hover,a:active{color:#FF6600;}
.clear{clear:both;height:0px;overflow:hidden;}
#header{width:660px;margin:0 auto;}
#topnav{margin:0 auto;height:22px;padding:0px 0px 0px 2px;border-bottom:1px solid #e3e3e3;}
#topnav li{float:left;padding:0px 10px;line-height: 22px;background:url(./images/tumenuj.gif) no-repeat right;}
.bt{background: #3366bb;color: white;padding: 0 9px;height: 30px;line-height: 30px;overflow: hidden;font-size: 14px;font-weight: bolder;margin: 0px 10px;}
#bo1{width: 660px;margin:0 auto;clear:both;}
#bo1 .todayt{float: right;font-weight: bold;height: 30px;line-height: 30px;}
#bo1 #logo{float: left;width: 250px;padding:0px 40px;}
#bo1 .todayw{float: left;text-align: center;padding:15px 0px 0px 0px;line-height: 20px;}
#bo1 h1,#bo1 h2{line-height: 30px;}
#bo2{width: 660px;margin:0 auto;clear:both;}
#bo2 .wbox{width: 96px;height: 220px;border: 1px solid #c2d0e7;background: white;float: left;text-align: center;margin: 10px 0px 0px 10px;display: inline;}
#bo2 .wbox h3{width: 100%;float: left;border-bottom: 1px solid #c2d0e7;background: #f5f7fb;font-size: 12px;line-height: 25px;font-weight: bolder;}
#bo2 .wbox img{margin: 15px 0px 20px 0px;}
#bo2 .wbox p{width: 100%;float: left;text-align: center;line-height: 1.8;}
#bo2 .wbox p.pts1{font-weight: bolder;color: #cc0000;font-size: 14px;}
#bo2 .wbox p.pts2{font-weight: bolder;color: #0033cc;font-size: 14px;}
#bo3{width: 660px;margin:10px auto 0px auto;clear:both;}
#bo3 dl{width: 315px;float: left;margin: 10px 0 0 10px;display: inline;line-height: 1.8;background: #ebeff7;height: 110px;}
#bo3 dt{width: 70px;float: left;margin: 15px 0 0 10px;}
#bo3 dd{width: 210px;float: left;margin: 15px 0 0 15px;display: inline;}
#bo3 dd em{color: #cc0000;}
#bo3 dd i{color: #009900;}
#bo4{width: 660px; margin:10px auto 1px auto;clear:both;text-align: center;line-height: 30px;}
#footer{width:660px; margin:10px auto 1px auto;clear:both; text-align:center;}
#footercontent{ padding:6px;border:1px solid #A5B5C0;background:#EBEEF6;}
#footercopyrights{padding:6px;line-height: 20px;}
</style>
<script language="JavaScript" src="./calendar.js"></script>
</head>
<body>
<div id="header">
  <div id="topnav">
    <ul>
      <li><a href="">首页</a></li>
      <li><a href="">新闻资讯</a></li>
      <li><a href="">分类信息</a></li>
      <li><a href="">房产租售</a></li>
      <li><a href="">留学出国</a></li>
      <li><a href="">求职招聘</a></li>
      <li><a href="">商家黄页</a></li>
      <li><a href="">福清地图</a></li>
      <li><a href="">福清博客</a></li>
      <li style="background:none"><a href="">福清论坛</a></li>
    </ul>
  </div>
</div>
<?
	require( "b.php" );
?>
<div class="clear"></div>
<div id="bo4">当天<?= $tqcity ?>天气调用:<input type="text" size=75 value="<script language='JavaScript' src='<?= $tqurl ?>?a=today'></script>" /><br />以上天气信息由中央气象局提供</div>
<div class="clear"></div>
<div id="footer">
<hr height="1" />
  <div id="footercopyrights">
    Copyright&nbsp;&copy;&nbsp;2009&nbsp;XXXXXX.COM&nbsp;Incorporated.&nbsp;All&nbsp;rights&nbsp;reserved<br />

<div style="display:none;">
	<!-- 希望你能保留这个链接 -->
	<a href="http://www.cnfq.com/">福清网</a>
</div>


  </div>
</div>

</body>
</html>
<?
}
?>

⌨️ 快捷键说明

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