แจกสคิปเจน Sitemap

เริ่มโดย aomnaruk, 27 เมษายน 2007, 14:13:29

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

aomnaruk


<?
//edit onely next line
$maxpages=0; //$maxpages=0 => all pages will be indexed; $maxpages=## => onely ## will be indexed  
//END

if(!empty($_GET[filename]) and file_exists(str_replace(strrchr($_SERVER[SCRIPT_FILENAME], "/"), "", $_SERVER[SCRIPT_FILENAME])."/".$_GET[filename])){

   header('Content-type: application/xhtml+xml');
   header("Content-Disposition: attachment; filename=\"{$_GET[filename]}\"");
   readfile(str_replace(strrchr($_SERVER[SCRIPT_FILENAME], "/"), "", $_SERVER[SCRIPT_FILENAME])."/".$_GET[filename]);
   exit();
}

set_time_limit(0);

function formatare_link($url_de_adaugat, $url_curent, $url_principal, $get){

   $parse_url_principal=parse_url($url_principal);
   if(!$parse_url_principal['path'] or $parse_url_principal['path']!="/"){

       $parse_url_principal['path']="/";
   }
   $parse_url_curent=parse_url($url_curent);
   $parse_url_de_adaugat=parse_url($url_de_adaugat);

   $parse_url_de_adaugat[path]=str_replace("..", "", $parse_url_de_adaugat[path]);
   $parse_url_de_adaugat[path]=preg_replace("/\/+/", "/", $parse_url_de_adaugat[path]);

   if(substr($parse_url_de_adaugat[path], 0, 1)=="/"){
       $parse_url_de_adaugat[path]=$parse_url_de_adaugat[path];

   }elseif(substr($parse_url_curent[path], -1)=="/"){
       $parse_url_de_adaugat[path]=$parse_url_curent[path].$parse_url_de_adaugat[path];

   }else{
       $parse_url_de_adaugat[path]=$parse_url_principal[path].$parse_url_de_adaugat[path];
   }
   
   $url_final=$parse_url_principal[scheme]."://".$parse_url_principal[host].$parse_url_de_adaugat[path];

   if($parse_url_de_adaugat[query]){$url_final.="?".$parse_url_de_adaugat[query];}
   $extensie=substr($url_final, -4);

   $extensie2=substr($url_final, -5);
   if($extensie==".css" or $extensie==".CSS" or $extensie==".gif" or $extensie==".GIF" or $extensie==".png" or $extensie==".PNG" or $extensie==".jpg" or $extensie==".JPG" or $extensie==".ico" or $extensie==".ICO" or $extensie2==".jpeg" or $extensie2==".JPEG"){

       $url_final="";
   }
   
   $www=substr($parse_url_principal[host], 0, 4);

   if($www=="www."){
       $url_principal_fara_www=substr($parse_url_principal[host], 4);
       $url_principal_cu_www=$parse_url_principal[host];

   }else{
       $url_principal_fara_www=$parse_url_principal[host];
       $url_principal_cu_www="www.".$parse_url_principal[host];
   }
   

   if(
   !$parse_url_de_adaugat[host] or
   $parse_url_de_adaugat[host]==$parse_url_principal[host] or

   $parse_url_de_adaugat[host]==$url_principal_fara_www or
   $parse_url_de_adaugat[host]==$url_principal_cu_www
   ){
       $url_final=$url_final;

   }else{
       $url_final="";
   }
   if($parse_url_de_adaugat[scheme]=="https"){
       $url_final="";

   }
   
   if(strstr($url_final, "?") and $get!=''){
   $query=explode("?", $url_final);

   $query2=explode("&", $query[1]);
   $strip=explode(",", $get);

   
   if(!empty($query2) and !empty($strip)){
       foreach($query2 as $vq){
       $x=array();
           foreach($strip as $vs){

               $vs=trim($vs);
               if(preg_match("/^$vs/", $vq)){
                   $x[]=1;

               }
           }
           if(count($x)==0){
               $p[]=$vq;
           }
       }
       if(!empty($p)){

           $qu=implode("&", $p);
           $url=$query[0]."?".$qu;

       }else{
           $url=$query[0];
       }
   }
   }else{
   $url=$url_final;
   }
   return $url;

}
function robotstxt($url_principal){
   $slash="";
   if(substr($url_principal, -1)!="/"){$slash="/";}

   if($r=@file_get_contents($url_principal.$slash."robots.txt")){
       $r=preg_replace("/\s+/m", " ", $r);

       $r=preg_replace("/Disallow: /", "", $r);
       $r=explode("User-agent: ", $r);

       foreach($r as $v){
           if(substr($v, 0, 1)=="*"){
               $v2=explode(" ", $v);

           }elseif(preg_match("/^rogio/i", $v)){
               $v4=explode(" ", $v);
           }

       }
       if($v2){
           foreach($v2 as $v3){
               if($v3 and $v3!="*"){
                   $disalow[]=$v3;

               }
           }
       }
       if($v4){
       foreach($v4 as $k5=>$v5){
           if($v5 and $v5!="*" and $k5!="0"){

               $disalow[]=$v5;
           }
       }
       $disalow=array_unique($disalow);
       return $disalow;
       }else{
           return null;

       }
   }
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Create your Google Sitemap </title>

<style type="text/css">
<!--
h1 {
   color: #FF9900;
   font-family: "Times New Roman", Times, serif;
   font-size: 36px;
   display:inline
}
h1 a{
   text-decoration: none;
}
.red {
   color: #FF0000;
   border-bottom-width: 2px;
   border-bottom-style: solid;
   border-bottom-color: #FF0000;
}
.green {
   color: #009900;
   border-bottom-width: 2px;
   border-bottom-style: solid;
   border-bottom-color: #009900;
}
.blue {
   color: #0000FF;
   border-bottom-width: 2px;
   border-bottom-style: solid;
   border-bottom-color: #0000FF;
}
-->
</style>
</head>
<body>
<form id="generate_sitemap" name="generate_sitemap" method="post" action="">

 <table width="598" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
   <tr bgcolor="#E4E4E4">
     <td colspan="3" align="center" valign="top" nowrap="nowrap" bgcolor="#FFFFFF"><h1>Create your Google Sitemap <br>
         powered by
                 <a href="http://www.phpscriptexpert.com"><span class="red">PHP</span><span class="green">script</span><span class="blue">EXPERT.com</span></a> </h1>
     </td>

   </tr>
   <tr bgcolor="#E4E4E4">
     <td width="106" align="right" valign="top" nowrap="nowrap"><b>Site URL:</b> </td>
     <td width="200" valign="top"><input name="url" type="text" value="<? if($_POST['url']){echo $_POST['url'];}else{echo "http://";}?>" size="40"></td>

     <td width="268" valign="top">URL  of the home page.</td>
   </tr>
   <tr bgcolor="#FFFFFF">
     <td align="right" valign="top" nowrap="nowrap">Strip session id </td>

     <td valign="top"><input name="strip" type="text" id="strip" value="sid, phpsessid" size="40"></td>
     <td valign="top">You need to remove session IDs from pages? Including session IDs in URLs may result in incomplete crawling of your site.</td>

   </tr>
   <tr bgcolor="#E4E4E4">
     <td align="right" valign="top" nowrap="nowrap"><b>Last modified</b>:</td>
     <td valign="top"><input name="last_modified" type="text" value="<?=date("Y-m-d")?>" size="15"></td>

     <td valign="top">The date of last modification of the file. This date should be in YYYY-MM-DD<a href="http://www.google.com/url?sa=D&amp;q=http://www.w3.org/TR/NOTE-datetime"></a> format. </td>

   </tr>
   <tr bgcolor="#FFFFFF">
     <td align="right" valign="top" nowrap="nowrap"><b>Change frequency</b>:</td>
     <td valign="top"><select name="change_frequency" id="Change frequency">

         <option value="always">always</option>
         <option value="hourly">hourly</option>
         <option value="daily">daily</option>
         <option value="weekly">weekly</option>

         <option value="monthly" selected="selected">monthly</option>
         <option value="yearly">yearly</option>
         <option value="never">never</option>
       </select></td>

     <td valign="top">How  frequently the page is likely to change.</td>
   </tr>
   <tr bgcolor="#E4E4E4">

     <td align="right" valign="top" nowrap="nowrap"><b>Priority</b></td>
     <td valign="top"><select name="priority" id="Priority">
         <option value="0.0">0.0</option>

         <option value="0.1">0.1</option>
         <option value="0.2">0.2</option>
         <option value="0.3">0.3</option>
         <option value="0.4">0.4</option>

         <option value="0.5" selected="selected">0.5</option>
         <option value="0.6">0.6</option>
         <option value="0.7">0.7</option>
         <option value="0.8">0.8</option>

         <option value="0.9">0.9</option>
         <option value="1.0">1.0</option>
       </select></td>
     <td valign="top">The  priority of this URL relative to other URL's on your site. Valid values  range from 0.0 to 1.0. The default priority of a page is 0.5. Search  engines use this information when selecting between URL's on the same  site</td>

   </tr>
   <tr bgcolor="#FFFFFF">
     <td colspan="3" align="center"><input name="generate_sitemap" type="submit" id="generate_sitemap" value="Generate sitemap"></td>
   </tr>

 </table>
</form>
<?
if($_POST['generate_sitemap']){
if(!empty($_POST['url']) && @file_get_contents($_POST['url'])){

   $urlok=1;
}else{
   echo "<h3 align=center style='color: red'>Bed URL!</h3>";
   $urlok=0;

}
$isok=$urlok;
if($isok==1){
echo "Creating your sitemap. Please weit ...\n";

echo '
<style type="text/css">
<!--
body,td,th {
   font-family: Arial, Helvetica, sans-serif;
   font-size: 12px;
}
-->

</style>
<script language="javascript">
function pageScroll() {
       window.scrollBy(0,50); // horizontal and vertical scroll increments
       scrolldelay = setTimeout("pageScroll()",100); // scrolls every 100 milliseconds

}
function stopScroll() {
       clearTimeout(scrolldelay);
}
pageScroll();
</script>
<pre>';
$db=array();
$main_url=$_POST['url'];

$url_sitemap=parse_url($main_url);
$db[$main_url]=0;
$asd=array("href=\"", "href='", "src=\"", "src='", "\"", "'", ">");

$dsa=array("href=", "href=", "src=", "src=", " ", " ", " ");

$disalow=robotstxt($main_url);
$links_final=array();
$xyz=0;
while($xyz<=$maxpages){

if($maxpages>=1){
$xyz++;
}
   $current_url=array_search(0, $db);
   if(!$current_url){break;}

   $db[$current_url]=1;
flush();
ob_flush();
echo "($xyz) indexing: $current_url\n";
flush();

ob_flush();
   $file=@file_get_contents($current_url);
   $file=strtolower(preg_replace("/\s+/m", " ", $file));

   $file_array = explode("<", $file);
   $links_final=array();
   foreach($file_array as $v_file_array){
       $v_file_array=str_replace($asd, $dsa, $v_file_array);

       if (
           (preg_match("/^a/", $v_file_array) or
           preg_match("/^frame/", $v_file_array) or

           preg_match("/^iframe/", $v_file_array)) and
           (stristr($v_file_array, "href") or stristr($v_file_array, "src")) and

           !stristr($v_file_array, "href=javascript") and
           !stristr($v_file_array, "href=mailto")
       ) {

           preg_match('|href=(.*) |U', $v_file_array, $regs);
           if (($a=formatare_link($regs[1], $current_url, $main_url, $_POST['strip']))  != ''){

               if($disalow){
                   foreach ($disalow as $v_disalow){
                       if(!stristr($a, '$v_disalow')){
                           if($db[$a]!=1){

                               $db[$a]=0;
                           }
                           break;
                       }
                   }
               }else{
                   if($db[$a]!=1){

                       $db[$a]=0;
                   }
               }
           }
           preg_match('|src=(.*) |U', $v_file_array, $regs);

           if (($a=formatare_link($regs[1], $current_url, $main_url, $_POST['strip']))  != ''){

               if($disalow){
                   foreach ($disalow as $v_disalow){
                       if(!stristr($a, '$v_disalow')){
                           if($db[$a]!=1){

                               $db[$a]=0;
                           }
                           break;
                       }
                   }
               }else{
                   if($db[$a]!=1){

                       $db[$a]=0;
                   }
               }
           }
       }
   }
}
$site_lastmod=htmlspecialchars($_POST['last_modified']);

$site_changefreq=htmlspecialchars($_POST['change_frequency']);
$site_priority=htmlspecialchars($_POST['priority']);
$sitemap="<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">
";
$sitemap2="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">
";

foreach($db as $site_link=>$val){
$site_link=htmlspecialchars(htmlspecialchars($site_link));
$site_link2=htmlspecialchars($site_link);

$sitemap.="<url>
   <loc>$site_link</loc>
   <lastmod>$site_lastmod</lastmod>
   <changefreq>$site_changefreq</changefreq>

   <priority>$site_priority</priority>
</url>  
";
$sitemap2.="<url>
   <loc>$site_link2</loc>

   <lastmod>$site_lastmod</lastmod>
   <changefreq>$site_changefreq</changefreq>
   <priority>$site_priority</priority>
</url>  
";
}

$sitemap.="</urlset>";
$sitemap2.="</urlset>";
$filename=date("YmdHis")."-".$url_sitemap['host']."-sitemap.xml";;

$current_directory=str_replace(strrchr($_SERVER['SCRIPT_FILENAME'], "/"), "", $_SERVER['SCRIPT_FILENAME'])."/";

$handle = fopen($current_directory.$filename, 'w');
fwrite($handle, $sitemap2);
fclose($handle);

$count=count($db);
$count1=array_count_values($db);
echo "\n<b>$count</b> links found in <b>{$count1[1]}</b> pages\n\n";

?>
<br>
<textarea name="textarea" cols="100" rows="10"><?=$sitemap?></textarea>
<br>
View <a href="<?=$filename?>" target="_blank">sitemap</a><br>

Download <a href="?filename=<?=$filename?>" target="_blank">sitemap</a> <br>
<div align="right"><a href="javascript:stopScroll()">Stop scrolling effect</a></div>

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


ลองเอาไปปรับแต่ไปใช้กันครับ :lol:  :lol:  :lol:

9vZa

ขอบคุณคับ ไม่รู้ใช้ได้ผลไม่ได้ผล ขอลองก่อน อิอิ

sincere


[direct=http://www.siamlc.com]ขายกระเป๋า Longchamp นำเข้า[/direct]
[direct=http://www.qualitymart.info]Jewelry Quality Shop[/direct]
[direct=http://www.buyexcellent.info/]155 ปั่น Sub Auto Keyword[/direct]
[direct=http://www.fungplang.com][/direct]

tonzatatay

ขอเอาไปลองหน่อยคับ   ขอบคุณ....... :wanwan020:

xtoygarx

ถ้าจะเอาไป gen aom ได้มั๊ยครับ

Asanohsab


ming0189


pomchai

ขอบคุณครับ ต้องขอเอาไปลองดูก่อน

chui761

ขอขยายความหรือตัวอย่างวิธีติดตั้งจะดีมากเลยครับ

ขอบคุณครับ
[direct=http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=amazonnrr]เช่าโฮสเกเตอร์ Promotion ลด 50% click[/direct]|
Hostgator คูปอง Baby plan เดือนแรก 0.01$=TSBSAVE001 หลายเดือนลด 25%=TSBSAVE025 |[direct=http://www.amzhowto.com/websitemap/]สอน Clickbank Amazon CPA/Payday Viglink เช่าโฮสต์นอก จดโดเมนราคาถูก[/direct]
[direct=http://support.hostneverdie.com/aff.php?aff=156]เช่าโฮสต์ไทย hostneverdie[/direct]
[direct=http://hosterbox.com/billing/aff.php?aff=139]Hosterbox Host นอกราคาประหยัด คุณภาพดีไม่แพ้ gator[/direct]