Add new sitemaps
This commit is contained in:
45
sitemap-board.php
Normal file
45
sitemap-board.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?
|
||||
if (! isset($_GET['board']) OR ! is_numeric($_GET['board'])) {
|
||||
header("{$_SERVER['server_protocol']} 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
$board = $_GET['board'];
|
||||
|
||||
require_once ('Settings.php');
|
||||
|
||||
mysql_connect($db_server,$db_user,$db_passwd);
|
||||
mysql_select_db($db_name);
|
||||
$query = mysql_query("SELECT t.ID_TOPIC, m.posterTime, m.modifiedTime, t.numReplies FROM smf_topics AS t, smf_messages AS m WHERE t.ID_BOARD='{$board}' AND t.ID_LAST_MSG=m.ID_MSG AND t.ID_BOARD NOT IN (13,14,26,39)");
|
||||
|
||||
|
||||
if($query === FALSE) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
echo "<html><head><title>500 Internal Server Error</title></head><body>Internal server error. Please, come again later.</body><html>";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (mysql_num_rows($query) == 0) {
|
||||
header("{$_SERVER['server_protocol']} 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
||||
?>
|
||||
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
|
||||
<?
|
||||
while($row = mysql_fetch_row($query)) {
|
||||
if (empty ($row[0])) continue;
|
||||
$ts = ($row[2] > $row[1]) ? date(DATE_W3C, $row[2]) : date(DATE_W3C, $row[1]);
|
||||
$pages = ceil($row[3] / 30);
|
||||
for (;$pages>=0;$pages--) {
|
||||
?>
|
||||
<url>
|
||||
<loc>http://rock.ru/forum/index.php?topic=<?=$row[0]?>.<?=$pages*30?></loc>
|
||||
<lastmod><?=$ts?></lastmod>
|
||||
<changefreq><?=$pages>0 ? 'daily' : 'hourly'?></changefreq>
|
||||
</url>
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</urlset>
|
||||
24
sitemap-index.php
Normal file
24
sitemap-index.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?
|
||||
require_once ('Settings.php');
|
||||
mysql_connect($db_server,$db_user,$db_passwd);
|
||||
mysql_select_db($db_name);
|
||||
$query = mysql_query("SELECT ID_BOARD AS id FROM smf_boards WHERE ID_BOARD NOT IN (13,14,26,39)");
|
||||
|
||||
if($query === FALSE) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
echo "<html><head><title>500 Internal Server Error</title></head><body>Internal server error. Please, come again later.</body><html>";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
||||
?>
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<?
|
||||
while($row = mysql_fetch_row($query)) {
|
||||
if (empty ($row[0])) continue;
|
||||
?>
|
||||
<sitemap>
|
||||
<loc>http://rock.ru/forum/sitemap-board.php?board=<?=$row[0]?></loc>
|
||||
</sitemap>
|
||||
<? } ?>
|
||||
</sitemapindex>
|
||||
Reference in New Issue
Block a user