piterskiy

Sitemapp addurl

Mar 22nd, 2019
17,887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ($host=="domain1.com" and $uri=="/sitemap.xml")
  2. {
  3.   $host_array = array("domain1.com","domain2.com","domain3.com");
  4.  
  5.   $file_array = array();
  6.  
  7.   foreach ($host_array as $key=>$value)
  8.   {
  9.     create_keyword_file($value);
  10.     $content = file_get_contents("keyword/".$value.".txt");
  11.     $array = unserialize($content);
  12.  
  13.     foreach ($array[1] as $key2=>$value2)
  14.     {
  15.       $array[1][$key2] = "http://".$value."/".$array[1][$key2];
  16.     }
  17.  
  18.     $file_array = array_merge($file_array,$array[1]);
  19.   }
  20.  
  21.   srand($date);
  22.   shuffle($file_array);
  23.   array_splice($file_array,$sitemap_count);
  24.  
  25.   header("Content-Type: text/xml; charset=UTF-8");
  26.   echo('<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="sitemap.xsl"?><urlset  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  27.         xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
  28.         xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  29. ');
  30.   echo('    <url><loc>http://'.$host.'/</loc></url>
  31.         <lastmod>'.date("Y",$date).'-'.date("m",$date).'-'.date("d",$date).'</lastmod>
  32.         <changefreq>Daily</changefreq>
  33.         <priority>1</priority>
  34. ');
  35.   foreach ($file_array as $key=>$value)
  36.   {
  37.     echo('  <url>
  38.         <loc>'.$value.'</loc>
  39.         <lastmod>'.date("Y",$date).'-'.date("m",$date).'-'.date("d",$date).'</lastmod>
  40.         <changefreq>Daily</changefreq>
  41.         <priority>1</priority>
  42.     </url>
  43. ');
  44.   }
  45.   echo('</urlset>');
  46.   if ($log==1) add_file("log/".$host.".txt",date("d.m.Y H:i:s",$date)."\n".$_SERVER["HTTP_USER_AGENT"]."\n"."http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."\n\n");
  47.   exit;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment