电脑安全

您当前的位置:主页 > 电脑安全 >

php生成 google map代码-网络编程

来源:[db:来源]标题:   缓存    编辑:电脑技术全能网 时间:2019-09-22 06:21

原标题:php生成 google map代码-网络编程
   php天生 google map代码<title>Google Sitemap天生器</title><style type="text/css"><!--.agreement {border: 1px solid #666666;}.green {color: #00CC00;font-weight: bold;}.red {color: #FF0000; font-weight: bold; }#scroll {border: 1px solid #0000FF;line-height: 25px;height: 25px;width: 280px;text-align: left;}.red{background-color:#999999;text-align: center;filter:Alpha(opacity=80);/*通明度*/}#act {background-image: url([img]http://www.gyqpw.com/img/loading.gif[/img]);height: 27px;width: 282px;}--></style><script>var MyMar;function monitoring(){if(document.readyState =='complete'){ window.location='?i='+query_get();}}function query_get(){ var querystr = window.location.href.split("=");if(!Number(querystr[1])){var value=0;}else{var value=Number(querystr[1]);}return Number(value)+1; }MyMar=setInterval('monitoring()',3000);</script><div style="text-align: center;" id=all_a><div align="center" id=act><div align="center" id=scroll><div class="red" style="width:1%;"></div></div></div></div><div align="center">正在检索:<span id=link></span></div><div id="logs" class="agreement" style="height:420px; overflow:auto;"><? /*=========================================================== = 版权协定: = GPL () =------------------------------------------------------------ = 摘 要:URL网络函数 PHP5 = 版 本:1.0 =------------------------------------------------------------ = 开源stal 名目组 = 更新作者:jd808 = 最初日期:2008-4-18 ============================================================*/ $file='sitemap.xml'; //GOOGLE 须要的文件 履行时则做首页的常设URL存储文件$temp_file='temp.xml';//内页URL常设存储文件$url="http://www.gyqpw.com/"; //要搜寻的网站$timea=time();//开端时光 用户无需理它 尽管下面3个参数便可if(!$_GET['i']){file_put_contents($file,''); file_put_contents($temp_file,''); file_put_contents($file,con($url,$timea)); echo "<script> window.location='?i=bak'; </script>";}else{consts($_GET['i'],$timea,$file,$url);}function con($url,$timea) //操纵{echo "<script> document.getElementById('link').innerHTML='正在网络 ".$url." 的信息!';</script>"; $str = file_get_contents($url); $collection_url=collection_url($str,$url); $collection_url=array_flip($collection_url); foreach($collection_url as $key=>$value) {if(count(explode($url,$key))==2){$strurl.=$key."/n";} } return $strurl;}function consts($i,$timea,$file,$urlys){ $str =file_get_contents($file); //读取页面数据并出产字符串 $url=explode("/n",$str); $sum=count($url)-1; if($i=='bak') { $i=0; } /*进度条*/ $wid=round($i/$sum*100,2)."%";$div="<div class='red' style='width:".$wid.";'>$wid</div>";echo '<script>document.getElementById("scroll").innerHTML="'.$div.'";</script>';ob_flush();//开释缓存flush(); //将不再缓存里的数据发送到扫瞄器去 /*进度条END */ for($j=$i;$j<$sum;$j++) { if(!$url[$j]){continue;} if(!detection_url($url[$j])) //检测URL能否正当{continue;} $timeb=time();//跟踪时光if(($timeb-$timea)>=25){memory($collection_url,$j); //存储数据}/* URL表现跟踪*/echo "<script> document.getElementById('link').innerHTML='".$url[$j]."'; </script>";ob_flush();//开释缓存flush(); //将不再缓存里的数据发送到扫瞄器去/* URL表现跟踪END*/$urlstr=@file_get_contents($url[$j]);$collection_url[]=collection_url($urlstr,$urlys);$timec=time();//跟踪时光if(($timec-$timea)>=25){memory($collection_url,$j); //存储数据}if($j==$sum-1){memorys(); //存储数据 重要是天生正式的xml} }}function collection_url($str,$url) //网络URL并前往一个数组(以页面为主){preg_match_all('/<a.*?href="(.+?)"/is',$str,$matches); $urlexp=$matches[1]; for($j=0;$j<count($urlexp);$j++) {$urlexp[$j]=ltrim(str_replace("/r/n",'',$urlexp[$j]));$urlexp[$j]=ltrim(str_replace("/n",'',$urlexp[$j]));$urlexp[$j]=ltrim(str_replace("/r",'',$urlexp[$j]));if($urlexp[$j]=='#'){continue;}if($urlexp[$j]=='/#'){continue;} if(!strchr($urlexp[$j],'http://')) {//没有http://$urlall[]=$url.$urlexp[$j];echo $url.$urlexp[$j].'<br>';print "<script>document.getElementById('logs').scrollTop = document.getElementById('logs').scrollHeight;</script>";ob_flush();//开释缓存flush(); //将不再缓存里的数据发送到扫瞄器去 }else{if(count(explode($url,$urlexp[$j]))==2){$urlall[]=$urlexp[$j];echo $urlexp[$j].'<br>';print "<script>document.getElementById('logs').scrollTop = document.getElementById('logs').scrollHeight;</script>";ob_flush();//开释缓存flush(); //将不再缓存里的数据发送到扫瞄器去}else{unset($urlexp[$j]);}} } return $urlall; //前往本页面搜寻所失掉的数组}function memory($collection_url,$i){global $temp_file;if(is_array($collection_url)){for($h=0;$h<count($collection_url);$h++){for($l=0;$l<count($collection_url[$h]);$l++){$strts.=$collection_url[$h][$l]."/n";}}$wstr=file_get_contents($temp_file);file_put_contents($temp_file,$wstr.$strts);if($i==0){$i=2;}$k=$i-1;echo "<script> window.location='?i=".$k."'; </script>";exit;}}function memorys() //重要是天生正式的xml{global $temp_file,$file;$file_arr=array_flip(file($file));$temp_file_arr=array_flip(file($temp_file));$xmla='<?xml version="1.0" encoding="UTF-8"?>'."/r/n".'<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';$xmlc="/r/n</urlset>";foreach($file_arr as $keya=>$valuea){$keya=ltrim(str_replace("/r/n",'',$keya));$keya=ltrim(str_replace("/n",'',$keya));$keya=ltrim(str_replace("/r",'',$keya));$xml.='<url><loc>'.$keya.'</loc><lastmod>'.date("Y-m-d",time()).'</lastmod><changefreq>daily</changefreq></url>';}foreach($temp_file_arr as $keyb=>$valueb){$keyb=ltrim(str_replace("/r/n",'',$keyb));$keyb=ltrim(str_replace("/n",'',$keyb));$keyb=ltrim(str_replace("/r",'',$keyb));$xml.='<url><loc>'.$keyb.'</loc><lastmod>'.date("Y-m-d",time()).'</lastmod><changefreq>daily</changefreq></url>';}$strts=$xmla.$xml.$xmlc;file_put_contents($file,$strts);echo "<script>clearInterval(MyMar); document.getElementById('link').innerHTML='URL曾经网络实现!'; document.getElementById('all_a').innerHTML='<b>XML天生已实现!</b>'; </script>";}function detection_url($url){if(strrchr($url,'=')){return true;}if(substr($url,strlen($url)-1,1)=='/'){return true;}$postfix= strrchr($url,'.');switch ($postfix){case ".php":return true;break;case ".html":return true;break;case ".htm":return true;break;case ".asp":return true;break;case ".aspx":return true;break;case ".shtml":return true;break;}return false;}?></div>

上一篇:用PHP实现XML备份Mysql数据库-网络编程

下一篇:没有了