<?php
include_once('./_common.php');
header("Content-Type: application/xml; charset=utf-8");

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";

$bo_tables = ['car', 'review', 'maint']; // 등록된 게시판 목록

foreach ($bo_tables as $bo) {
    $sql = "SELECT wr_id, wr_datetime FROM g5_write_{$bo} ORDER BY wr_datetime DESC LIMIT 100";
    $res = sql_query($sql);
    while ($row = sql_fetch_array($res)) {
        echo "<url>\n";
        echo "<loc>https://car.deb.kr/bbs/board.php?bo_table={$bo}&wr_id={$row['wr_id']}</loc>\n";
        echo "<lastmod>".substr($row['wr_datetime'], 0, 10)."</lastmod>\n";
        echo "<changefreq>daily</changefreq>\n";
        echo "<priority>0.8</priority>\n";
        echo "</url>\n";
    }
}
echo "</urlset>";
?>
