<?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'
xmlns:news='http://www.google.com/schemas/sitemap-news/0.9'>";
require 'admin/config.php';
require 'funciones.php';
try {
$conexion = new PDO($bd_config['dbname'], $bd_config['usuario'], $bd_config['password'] );
} catch (PDOException $e) {
header ('Location: error.php');
echo "ERROR: ".$e->getMessage();
die();
}
$hoy = getdate();
$mes = $hoy['mon'];
$dia = $hoy['mday'];
if ($hoy['mon'] < 10) {
$mes = "0" . $mes;
}
if ($hoy['mday'] < 10) {
$dia = "0" . $dia;
}
$fecha_hoy = $hoy['year'] . "-" . $mes . "-" . $dia;
echo "<url>\n";
echo "<loc>http://www.laxtore.com/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Indice-Precios/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/contacto/</loc>\n";
echo "<priority>0.8</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM retrocompatibles_360 ORDER BY Agregado DESC");
$statement->execute();
$ultimo_juego_360 = $statement->fetchAll();
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-360/</loc>\n";
echo "<lastmod>" . substr($ultimo_juego_360[0]['Agregado'],0,10) . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM retrocompatibles_360 WHERE retro = 1 ORDER BY Agregado DESC");
$statement->execute();
$ultimo_juego_360_retro = $statement->fetchAll();
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/retrocompatibles/</loc>\n";
echo "<lastmod>" . substr($ultimo_juego_360_retro[0]['Agregado'],0,10) . "</lastmod>\n";
echo "<changefreq>monthly</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Deals-With-Gold/</loc>\n";
echo "<changefreq>weekly</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM art ORDER BY fecha_publicacion");
$statement->execute();
$articulos = $statement->fetchAll();
foreach ($articulos as $articulo) {
echo "<url>\n";
echo "<loc>http://www.laXtore.com/noticia/" . $articulo['ID'] . "/" . limpia_url($articulo['titulo']) . "/</loc>\n";
echo "<news:news>\n";
echo "<news:publication>\n";
echo "<news:name>LaXtore</news:name>\n";
echo "<news:language>es</news:language>\n";
echo "</news:publication>\n";
echo "<news:genres>Tecnología, Xbox One, videojuegos, videogames</news:genres>\n";
echo "<news:publication_date>" . substr($articulo['fecha_publicacion'],0,10) . "</news:publication_date>\n";
echo "<news:title>" . str_replace("&","and",$articulo['titulo']) . "</news:title>\n";
echo "<news:keywords>" . str_replace(",", ";",str_replace("&","and",$articulo['etiquetas'])) . "</news:keywords>\n";
echo "</news:news>\n";
echo "</url>\n";
}
$statement = $conexion->prepare("SELECT * FROM info_XboxOne ORDER BY agregado DESC");
$statement->execute();
while ($xbox_individual = $statement->fetch()) {
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/" . $xbox_individual['id'] . "/" . limpia_url($xbox_individual['Juego']) . "/</loc>\n";
echo "<lastmod>" . substr($xbox_individual['agregado'],0,10) . "</lastmod>\n";
echo "<priority>0.8</priority>\n";
echo "</url>\n";
}
echo "</urlset>\n";
?>