<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bj - el blog de un limonero &#187; Tutorial</title>
	<atom:link href="http://www.bujorel.net/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bujorel.net</link>
	<description>El blog de Bj</description>
	<lastBuildDate>Fri, 03 Apr 2009 05:31:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Office Genuine Advantage</title>
		<link>http://www.bujorel.net/tutorial/office-genuine-advantage/</link>
		<comments>http://www.bujorel.net/tutorial/office-genuine-advantage/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 06:28:09 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[office genuine advantage]]></category>
		<category><![CDATA[oga]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=134</guid>
		<description><![CDATA[Igual que para Windows Microsoft tiene el WGA, para Office tiene el OGA. El OGA requiere que los usuarios de Microsoft Office validen su copia para descargar actualizaciones no críticas del programa y otras descargas como complementos, agregados, etc. &#160;&#160; Para validar la copia hay que seguir estos dos pasos: · Descargar el archivo Office.Genuine.Advantage.Validation.v1.7.105.35.rar [...]]]></description>
			<content:encoded><![CDATA[<p>Igual que para <strong>Windows</strong> Microsoft tiene el <a href="http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/">WGA</a>, para <strong>Office</strong> tiene el <a href="http://es.wikipedia.org/wiki/Office_Genuine_Advantage">OGA</a>. </p>
<p>El OGA requiere que los usuarios de Microsoft Office validen su copia para descargar actualizaciones no críticas del programa y otras descargas como complementos, agregados, etc.</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2008/11/office_descarga_entero.png"><img src="http://www.bujorel.net/wp-content/uploads/2008/11/office_descarga.png" alt="Validación OGA" border="0" /></a></div>
<p>&nbsp;&nbsp;</p>
<p>Para validar la copia hay que seguir estos dos pasos:</p>
<p>· Descargar el archivo <a href="http://www.bujorel.net/proxy/proxy.php?file=Office.Genuine.Advantage.Validation.v1.7.105.35.rar">Office.Genuine.Advantage.Validation.v1.7.105.35.rar</a> y extraerlo<br />
· Ejecutar <strong>instalar.bat</strong></p>
<p>Después ya podremos validar la copia de Microsoft Office.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/11/office_ok.png" alt="OGA OK" /></div>
<p>Importante: al ejecutar el archivo <strong>instalar.bat</strong> se cerrara Internet Explorer.</p>
<p><strong>Actualización</strong>: Marzo 2009 &#8211; versión <em>1.7.105.35</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/office-genuine-advantage/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Como crear un túnel SSH</title>
		<link>http://www.bujorel.net/tutorial/como-crear-un-tunel-ssh/</link>
		<comments>http://www.bujorel.net/tutorial/como-crear-un-tunel-ssh/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 09:50:56 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[conxion segura]]></category>
		<category><![CDATA[encapsulacion]]></category>
		<category><![CDATA[encriptacion]]></category>
		<category><![CDATA[protocolo]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunel]]></category>
		<category><![CDATA[tunneling]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=121</guid>
		<description><![CDATA[SSH (Secure SHell) intérprete de comandos seguro &#8211; es el nombre de un protocolo y del programa que lo implementa, y sirve para acceder a máquinas remotas a través de una red. El protocolo SSH se utiliza con frecuencia para tunelizar tráfico confidencial sobre Internet de una manera segura. Ejemplo: PC usuario se conecta y [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://es.wikipedia.org/wiki/SSH">SSH</a> (Secure SHell) intérprete de <strong>comandos seguro</strong> &#8211; es el nombre de un <strong>protocolo</strong> y del programa que lo implementa, y sirve para acceder a <strong>máquinas remotas</strong> a través de una red.</p>
<p><img src="http://www.bujorel.net/wp-content/uploads/2008/10/openssh.jpg" alt="OpenSSH" /></p>
<p>El protocolo <strong>SSH</strong> se utiliza con frecuencia para <em>tunelizar</em> tráfico confidencial sobre Internet de una manera segura.</p>
<p><strong>Ejemplo</strong>:<br />
<strong>PC usuario</strong> se conecta y establece <strong>túnel SSH</strong> con el <strong>servidor SSH</strong>. Usuario quiere descargar el archivo <strong>proyecto.zip</strong> desde el servidor ftp://ejemplo.com. El <strong>servidor SSH</strong> se conecta con el <strong>servidor FTP</strong> con la clave proporcionada por PC usuario a servidor SSH bajo conexión segura y le devuelve el archivo a <strong>PC usuario</strong>.</p>
<p>Esto impide a terceros examinar el contenido de la trasmisión, algo posible si las comunicaciones se realizan en Internet.</p>
<p>También se puede usar para evitar los <strong>cortafuegos</strong> (firewalls). Simplemente se <strong>encapsula el protocolo HTTP</strong> o el protocolo bloqueado dentro de otro permitido.</p>
<p><strong>Para realizar un túnel SSH hace falta:</strong><br />
· un servidor SSH<br />
· <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Putty</a></p>
<p>Primero hay que <strong>crear la conexión</strong> con el servidor SSH, utilizando Putty:<br />
<span id="more-121"></span><br />
Introducimos la IP o el hostname del servidor y el puerto (predeterminado 22), dejando marcado el tipo de conexión SSH.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/putty_ip.png" alt="Putty" /></div>
<p>&nbsp;&nbsp;</p>
<p>Más abajo en <em>Connection</em> esta <em>SSH</em> y <em>Tunnels</em>:<br />
En <em>Source port</em> hay que poner el puerto &#8211; <strong>8080</strong> por ejemplo; marcamos <em>Dynamic</em> y pulsamos <em>Add</em>.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/putty_tunnels.png" alt="Putty" /></div>
<p>&nbsp;</p>
<p>Hecho esto ya podemos abrir la conexión.&nbsp;</p>
<p>Ahora, configuramos nuestro navegador para que se mediante el servidor SSH.<br />
<strong>IE7:</strong><br />
<em>Herramientas</em> -> <em>Opciones de Internet</em> -> <em>Conexiones</em> -> <em>Configuración de LAN</em>:</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/ie7_conf_1.png" alt="Configuración IE7" /></div>
<p>&nbsp;&nbsp;</p>
<p>Marcamos &#8220;<em>Usar un servidor proxy para la LAN</em>&#8221; y pulsamos en <em>Avanzadas</em>.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/ie7_conf_2.png" alt="Configuración IE7" /></div>
<p>&nbsp;&nbsp;</p>
<p>En <em>Socks </em>ponemos <strong>localhost</strong>: <strong>8080 </strong>o el puerto elegido antes.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/ie7_conf_3.png" alt="Configuración IE7" /></div>
<p>&nbsp;&nbsp;</p>
<p>Se puede poner <strong>127.0.0.1</strong> o <strong>localhost</strong>.&nbsp;</p>
<p><strong>Firefox</strong>:<br />
<em>Herramientas</em> -> <em>Opciones</em> -> <em>Avanzadas</em> -> <em>Red</em> -> <em>Configuración</em>:</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/firefox_conf_1.png" alt="Configuración Firefox" /></div>
<p>&nbsp;&nbsp;</p>
<p>Marcamos &#8220;<em>Configuración manual de proxy</em>&#8221; y en ponemos <strong>127.0.0.1</strong> como <em>Servidor SOCKS</em> y el puerto elegido.</p>
<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2008/10/firefox_conf_2.png" alt="Configuración Firefox" /></div>
<p>&nbsp;&nbsp;</p>
<p>Como observación final, para los que no disponen de un servidor Linux, se puede utilizar el ordenador personal (de casa) instalando <a href="http://sshwindows.sourceforge.net/">OpenSSH</a> para Windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-crear-un-tunel-ssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nueva actualización de WGA</title>
		<link>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/</link>
		<comments>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 18:52:07 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[wga]]></category>
		<category><![CDATA[windows genuine advantage]]></category>
		<category><![CDATA[windows original]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=81</guid>
		<description><![CDATA[Microsoft ha vuelto a actualizar el sistema WGA sobre el cual escribía hace tiempo aquí. La nueva versión &#8211; 1.9.40.0 es algo mas agresiva ya que entre otras cosas quita el fondo de escritorio, dejándolo en negro. Aunque el usuario establezca un nuevo fondo, cada 60 minutos volverá a negro hasta que la copia de [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft ha vuelto a actualizar el sistema <strong>WGA</strong> sobre el cual escribía hace tiempo <a href="http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/">aquí</a>.</p>
<p>La nueva versión &#8211; <strong>1.9.40.0</strong> es algo mas agresiva ya que entre otras cosas quita el fondo de escritorio, dejándolo en <strong>negro</strong>. Aunque el usuario establezca un nuevo fondo, <strong>cada 60 minutos</strong> volverá a negro hasta que la copia de Windows sea original.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/09/nuevo_wga.png' alt='Nuevo WGA 1.8' /></p>
<p>También hay una notificación que se queda al lado de la barra de tareas simulando una <a href="http://es.wikipedia.org/wiki/Marca_al_agua">marca al agua</a> (watermark) que no es interactiva.<br />
El aviso parece que siempre está en inglés.</p>
<p>Para validar la copia hay que seguir estos sencillos pasos:</p>
<p>· Descargar <a href="http://www.bujorel.net/proxy/proxy.php?file=Windows.Genuine.Advantage.Validation.v1.9.40.0.rar">este archivo</a> y extraerlo<br />
· Ejecutar <strong>instalar.bat</strong><br />
· Reiniciar el ordenador</p>
<p>Para mas información puede consultar el <a href="http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/">artículo anterior</a>.</p>
<p><strong>Actualización</strong>: Septiembre 2008 &#8211; versión <em>1.8.31.9</em>.<br />
<strong>Actualización</strong>: Octubre 2008 &#8211; versión <em>1.8.32.0</em>.<br />
<strong>Actualización</strong>: Noviembre 2008 &#8211; versión <em>1.8.32.1</em>.<br />
<strong>Actualización</strong>: Marzo 2009 &#8211; versión <em>1.9.40.0</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/nueva-actualizacion-de-wga/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Comprimiendo las hojas de estilo &#8211; CSS</title>
		<link>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/</link>
		<comments>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 17:13:49 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[comprimir]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[hojas de estilo]]></category>
		<category><![CDATA[optimizar]]></category>
		<category><![CDATA[style.css]]></category>
		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/?p=75</guid>
		<description><![CDATA[El otro día empecé a modificar algunas cosas en el blog para optimizarlo: limpiar el tema, optimizar el javascript y una cosa importante fue optimizar o mejor dicho comprimir el archivo CSS del tema de este blog. Algunos páginas pueden tener incluso más archivos CSS cosa que no recomiendo porque solo aumentan el número de [...]]]></description>
			<content:encoded><![CDATA[<p>El otro día empecé a modificar algunas cosas en el blog para optimizarlo: limpiar el tema, optimizar el javascript y una cosa importante fue optimizar o mejor dicho comprimir el archivo <a href="http://es.wikipedia.org/wiki/CSS">CSS</a> del tema de este blog.<br />
Algunos páginas pueden tener incluso más archivos CSS cosa que no recomiendo porque solo aumentan el número de consultas del servidor web y por lo tanto tardan más en cargar.</p>
<p>Comprimiendo el CSS además ahorra ancho de banda especialmente en sitios donde hay más de <strong>1.000 líneas</strong> de código.</p>
<p>Hay varias páginas donde podrás comprimir el archivo CSS, pero el problema puede ser el mantenimiento del archivo después.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/04/css-comp.png' alt='Comprimiendo CSS' /></p>
<p>Para optimizarlo principalmente hay dos opciones:<br />
• comprimir el archivo CSS simplemente<br />
• crear un <strong>script PHP</strong> que comprima el archivo cada vez que es solicitado</p>
<p><span id="more-75"></span>Cada opción tiene su ventaja e inconveniente.<br />
El script PHP tiene la ventaja de que es muy fácil mantener el archivo CSS para hacer modificaciones, pero cada vez que se cargue la pagina el servidor tendrá que servir el código PHP.<br />
Yo como no suelo modificar el archivo CSS muy a menudo he optado por hacerlo estático &#8211; he comprimido el código CSS y lo he subido directamente al servidor.</p>
<p>1. Ambas opciones son bastante simples y eficaces, especialmente la primera.<br />
Para comprimir el archivo CSS he probado varios &#8220;servicios&#8221; web y finalmente me he<br />
decidido por <a href="http://iceyboard.no-ip.org/projects/css_compressor">Ice CSS Compressor</a>.</p>
<p>El resultado es asombroso:<br />
• Tamaño original: <strong>10.65 kB</strong> (10,910 B)<br />
• Tamaño final: <strong>5.48 kB</strong> (5,608 B)<br />
• Ahorrado: <strong>5.18 kB</strong> (5,302 B)<br />
• Reducción: <strong>48.6%</strong></p>
<p>2. La segunda opción es un poco más compleja &#8211; además de <strong>PHP</strong> requiere utilizar el archivo <strong>.htaccess</strong>.</p>
<p>Así es como funciona:<br />
• El navegador el usuario pide la hoja de estilo (archivo CSS) como siempre<br />
• El servidor comprime la hoja de estilo utilizando PHP<br />
• La hoja de estilo es servida al navegador</p>
<p>Todo esto pasa completamente desapercibido para el usuario.<br />
Además tiene la ventaja de que no hay que modificar el código CSS original.</p>
<p>Primero hay que añadir este código al principio del archivo CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-type: text/css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;compress&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">function</span> compress<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// quita comentarios</span>
    <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'!/\*[^*]*\*+([^/][^*]*\*+)*/!'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> 
      <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// quita tabuladores, espacios, nuevas lineas, etc.</span>
    <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span>
       <span style="color: #0000ff;">'  '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'    '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'    '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buffer</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>La primera línea informa al navegador de que esto es una hoja de estilos CSS.<br />
La función de comprimir es utilizada para quitar los comentarios y los espacios.<br />
Finalmente, el CSS comprimido es mandado al navegador.</p>
<p>Al final del archivo CSS hay que añadir esta línea:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">ob_end_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Es para que el script sepa hasta donde tiene que colectar en el buffer la información que tiene que comprimir.</p>
<p>El último paso es necesario para seguir manteniendo la extensión CSS del archivo.<br />
Hay que modificar (o crear) el archivo <em>.htacces</em> y añadir un <strong>SetHandler</strong> que sirve para procesar otras extensiones como PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">Files</span> style.css&gt;
  <span style="color: #00007f;">SetHandler</span> application/x-httpd-php 
&lt;/<span style="color: #000000; font-weight:bold;">Files</span>&gt;</pre></div></div>

<p>Puedes descargar desde <a href="http://www.bujorel.net/wp-content/uploads/2008/04/CSS-comp.rar">aquí</a> ambos archivos para utilizarlos directamente.</p>
<p>Antes <a href="http://www.bujorel.net/wp-content/themes/ds/original_style.css">mi archivo CSS</a> pesaba <strong>10.6 KB</strong> (10.910 bytes).<br />
Ahora después de comprimirlo <a href="http://www.bujorel.net/wp-content/themes/ds/style.css">tiene casi la mitad</a> del tamaño <strong>5,47 KB</strong> (5.608 bytes).</p>
<p><strong>Nota:</strong> <em>las hojas de estilo de los blogs tienen un encabezado para la identificación donde están los detalles como el nombre, el creador, la pagina web&#8230;<br />
Se puede añadir después de comprimir el archivo para mantener la información aunque funciona perfectamente sin.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/comprimiendo-las-hojas-de-estilo-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Como crear un feed RSS desde MySQL con PHP</title>
		<link>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/</link>
		<comments>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 01:14:52 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/</guid>
		<description><![CDATA[Recientemente he tenido que hacer un feed RSS para una página de antigüedades que tenía unos 90-100 artículos en puro HTML. Así que he optado por utilizar una base de datos. Mejor de cara a futuras actualizaciones (nuevos artículos) e incluso más practico ahora. El feed RSS es un sencillo formato de datos que es [...]]]></description>
			<content:encoded><![CDATA[<p>Recientemente he tenido que hacer un feed <strong>RSS</strong> para una página de antigüedades que tenía unos 90-100 artículos en puro <strong>HTML</strong>.<br />
Así que he optado por utilizar una base de datos.<br />
Mejor de cara a futuras actualizaciones (nuevos artículos) e incluso más practico ahora.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/02/feed-icon.png' alt='RSS Feed Icon' /> El <a href="http://es.wikipedia.org/wiki/Feed">feed</a> <a href="http://es.wikipedia.org/wiki/RSS">RSS</a> es un sencillo formato de datos que es utilizado para redifundir contenidos a suscriptores de un sitio web. El formato permite distribuir contenido sin necesidad de un navegador, utilizando un software diseñado para leer estos contenidos RSS (agregador). A pesar de eso, es posible utilizar el mismo navegador para ver los contenidos RSS. Las últimas versiones de los principales navegadores permiten leer los RSS sin necesidad de software adicional.</p>
<p><strong>Base de datos</strong><br />
El primer paso será crear la base de datos y añadir los datos. Si nuestra página ya utiliza algún tipo de base de datos para guardar los artículos no será necesario crear otra base de datos ni tampoco hacer cambios.<br />
Básicamente necesitaremos estos campos en la tabla:<br />
• <strong>id</strong> &#8211; no es obligatorio pero siempre me gusta que las tablas estén numeradas<br />
• <strong>categoria</strong> &#8211; categoría o tag del articulo (nos permitirá organizar mejor)<br />
• <strong>titulo</strong> &#8211; título que veremos en el RSS<br />
• <strong>resumen</strong> &#8211; un breve resumen del articulo (si ponemos el texto entero, el usuario no tendrá interés de visitar nuestra página)<br />
• <strong>fecha</strong> &#8211; fecha del articulo para la organización (los más nuevos son los primeros)<br />
• <strong>enlace</strong> &#8211; enlace a la pagina del articulo completo</p>
<p>Esta sería la <strong>estructura SQL</strong> para facilitar un poco el proceso:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`articulos`</span> <span style="color: #FF00FF;">&#40;</span>
  <span style="color: #008000;">`id`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">auto_increment</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`categoria`</span> <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`titulo`</span> <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`resumen`</span> <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`fecha`</span> <span style="color: #999900; font-weight: bold;">date</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`enlace`</span> <span style="color: #999900; font-weight: bold;">text</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #FF9900; font-weight: bold;">UNIQUE</span> <span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #008000;">`id`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`id`</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM  <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF9900; font-weight: bold;">CHARSET</span><span style="color: #CC0099;">=</span>utf8 <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #CC0099;">=</span><span style="color: #008080;">1</span> <span style="color: #000033;">;</span></pre></div></div>

<p></p>
<p><strong>Código PHP</strong></p>
<p>Lo primero será abrir un archivo RSS (.xml / .rss):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index.xml'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>El siguiente paso es escribir <strong>la cabecera</strong> en el archivo index.xml (esta información suele ser estática):<br />
<span id="more-66"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">$rand = &quot;\n&quot;;
fwrite($fp, '<span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>' .$rand);
fwrite($fp, '&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;' .$rand);
fwrite($fp, '&lt;channel&gt;' .$rand);
fwrite($fp, '&lt;title&gt;Bujorel' .$dirname. '&lt;/title&gt;' .$rand);
fwrite($fp, '&lt;description&gt;Bj - El blog de un limonero&lt;/description&gt;' .$rand);
fwrite($fp, '&lt;link&gt;http://www.bujorel.net' .$dirname. '/&lt;/link&gt;' .$rand);
fwrite($fp, '&lt;language&gt;es-sp&lt;/language&gt;' .$rand);
fwrite($fp, '&lt;copyright&gt;Copyright ' .date('Y'). ' Bujorel.net&lt;/copyright&gt;' .$rand .$rand);</pre></div></div>

<p></p>
<p>Ahora es el turno de la base de datos (información que se actualiza continuamente).<br />
Realiza la <strong>conexión a la base de datos</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'usuario'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'contraseña'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'base_de_datos'</span><span style="color: #339933;">,</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Crea la consulta (query):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   	<span style="color: #000088;">$dirname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$dirname</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id,categoria,titulo,resumen,fecha,enlace FROM articulos ORDER BY fecha DESC&quot;</span><span style="color: #339933;">;</span>    
       <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>   
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM articulos WHERE categoria='<span style="color: #006699; font-weight: bold;">$categoria</span>' ORDER BY fecha DESC&quot;</span><span style="color: #339933;">;</span>    
       <span style="color: #009900;">&#125;</span>   
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se ha podido realizar la consulta.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Extrae la información:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$id</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$categoria</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'categoria'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$titulo</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$resumen</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resumen'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fecha</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fecha'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$enlace</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'enlace'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Y después escribe la información (contenido BBDD) en el archivo index.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$titulo</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$resumen</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;category&gt;![CDATA['</span> <span style="color: #339933;">.</span><span style="color: #000088;">$categoria</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">']]&lt;/category&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$enlace</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s O'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fecha</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>Finalmente escribe el &#8220;<strong>pie de página</strong>&#8221; (footer) del archivo index.xml:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/rss&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Cierra el archivo:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Y termina mostrando un mensaje:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Creado Feed RSS.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p><strong>Resultado final:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index.xml'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$rand</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;http://www.w3.org/2005/Atom&quot;&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;title&gt;Bujorel'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$dirname</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;description&gt;Bj - El blog de un limonero&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;link&gt;http://www.bujorel.net'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$dirname</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'/&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;language&gt;es-sp&lt;/language&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;copyright&gt;Copyright '</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">' Bujorel.net&lt;/copyright&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$db</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'usuario'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'contraseña'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'base_de_datos'</span><span style="color: #339933;">,</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   	<span style="color: #000088;">$dirname</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$dirname</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT id,categoria,titulo,resumen,fecha,enlace FROM articulos ORDER BY fecha DESC&quot;</span><span style="color: #339933;">;</span>    
       <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>   
	<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM articulos WHERE categoria='<span style="color: #006699; font-weight: bold;">$categoria</span>' ORDER BY fecha DESC&quot;</span><span style="color: #339933;">;</span>    
       <span style="color: #009900;">&#125;</span>   
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No se ha podido realizar la consulta.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$id</span>        <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$categoria</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'categoria'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$titulo</span>    <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'titulo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$resumen</span>   <span style="color: #339933;">=</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resumen'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fecha</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fecha'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$enlace</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'enlace'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$titulo</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/title&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$resumen</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/description&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;category&gt;![CDATA['</span> <span style="color: #339933;">.</span><span style="color: #000088;">$categoria</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">']]&lt;/category&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$enlace</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/link&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s O'</span><span style="color: #339933;">,</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fecha</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/pubDate&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/item&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/channel&gt;'</span> <span style="color: #339933;">.</span><span style="color: #000088;">$rand</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/rss&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Creado Feed RSS.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p></p>
<p>Ahora para utilizar esto si tenemos una página que no actualizamos muy a menudo o tenemos que actualizar la base de datos de forma manual podemos simplemente abrir el archivo php creado cuando hace falta actualizar el feed.<br />
Pero si tenemos una página que escribe en la base de datos directamente y la actualizamos más a menudo podemos poner este código HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;index.xml&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;XML&quot;</span> <span style="color: #000066;">onmouseover</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;parent.location='index-xml.php';&quot;</span>&gt;</span>   
 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/icon-xml.gif&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;icon-xml&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;XML&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>   
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<p></p>
<p>Cada vez que pasemos el ratón por encima del enlace se ejecutara el archivo<br />
<strong>index-xml.php</strong> (nuestro archivo) que actualizara el feed RSS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-crear-un-feed-rss-desde-mysql-con-php/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Como evitar el hotlinking con .htaccess</title>
		<link>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/</link>
		<comments>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 00:00:38 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[hotlinking]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[protección]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/</guid>
		<description><![CDATA[El hotlinking también llamado leeching, direct linking, inline linking o bandwidth theft (robo del ancho de banda) significa enlazar un archivo (casi siempre imagen &#8211; gif, jpg, png) que es de otra página que no es nuestra. Ejemplos (mostrando una imagen en HTML): Imagen en nuestro servidor: &#60;img src=&#34;imagen.jpg&#34; height=&#34;320&#34; width=&#34;240&#34; /&#62; Imagen en servidor [...]]]></description>
			<content:encoded><![CDATA[<p>El <a href="http://revistes.upc.es/wiki/Hotlinking"><strong>hotlinking</strong></a> también llamado <strong>leeching</strong>, <strong>direct linking</strong>, <strong>inline linking</strong> o <strong>bandwidth theft</strong> (robo del ancho de banda) significa enlazar un archivo (casi siempre imagen &#8211; gif, jpg, png) que es de otra página que no es nuestra.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/02/hotlinking.jpg' alt='No Hotlinking Please'  border='0' /></div>
<p></p>
<p><strong>Ejemplos</strong> (mostrando una imagen en HTML):<br />
Imagen en nuestro servidor:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;imagen.jpg&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;240&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p></p>
<p>Imagen en servidor ajeno (hotlinking):</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.sitio.com/imagen.jpg&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;240&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p></p>
<p>En el primer ejemplo la imagen siempre es cargada desde el servidor que sirve la pagina, pero en el segundo ejemplo, cada vez que nuestra página carga, la imagen es cargada desde el servidor externo que usa su ancho de banda para mostrar la imagen.</p>
<p>Se puede evitar el hotlinking utilizando el archivo <a href="http://en.wikipedia.org/wiki/Htaccess"><strong>.htaccess</strong></a>. Este archivo está disponible solamente en servidores <strong>Apache</strong> sobre <strong>Linux</strong>. El punto delantero (.) significa que el archivo es oculto.</p>
<p><strong>Ejemplo:</strong> La dirección de tu página es <em>www.mipagina.com</em>. Para evitar el hotlinking a tus imágenes desde otros sitios y mostrar una imagen llamada <em>nohotlink.jpe</em> que está en la carpeta <em>imagenes</em>, pon este código en el archivo .htaccess:<br />
<span id="more-60"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} !^http://(.+\.)?mipagina\.com/ [NC]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} !^$
<span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ /imagenes/nohotlink.jpe [L]</pre></td></tr></table></div>

<p>La primera línea empieza a reescribir las opciones en Apache.<br />
La segunda línea verifica las coincidencias desde la propia página (<em>mipagina.com</em>).<br />
El código <strong>[NC]</strong> significa &#8220;<strong>No Case</strong>&#8220;, haciendo que no importe si esta en minúsculas o mayúsculas la dirección.<br />
La tercera línea es para permitir las referencias directas (poner directamente el link en la barra de dirección &#8211; sin referencias de otras páginas).<br />
Finalmente la última línea sirve para las extensiones de los archivos <strong>jpeg</strong>, <strong>jpg</strong>, <strong>gif</strong>, <strong>bmp</strong>, <strong>png</strong>. Estas son reemplazadas por la imagen <em>nohotlink.jpg</em> que está en la carpeta <em>imagenes</em>. Esta imagen <em>JPEG</em> utiliza la extensión <em>jpe</em> y no <em>jpg</em> para evitar ser también bloqueada.</p>
<p>Para evitar el hotlinking solamente desde unos dominios específicos, como <em>digg.com</em>, <em>myspace.com</em> y <em>blogspot.com</em>, pero permitirlo para cualquier otro, utiliza este código:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?digg\.com/ [NC,OR]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
<span style="color: #00007f;">RewriteCond</span> %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC]
<span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ /imagenes/nohotlink.jpe [L]</pre></td></tr></table></div>

<p>Puedes añadir tantos dominios como quieras. Cada línea <strong>RewriteCond</strong> debe acabar con <strong>[NC,OR]</strong>. <strong>[NC]</strong> (No Case) significa que ignore las diferencias entre minúsculas y mayúsculas. <strong>[OR]</strong> &#8220;<strong>Or Next</strong>&#8221; significa que pase a la siguiente línea buscando coincidencias. El último dominio omite el uso de OR para dejar de seguir buscando coincidencias.</p>
<p>Si no quieres poner una imagen puedes redireccionar a una página web o mostrar una página de error <strong>403 Forbidden</strong>. Cambia la última línea con esta:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">RewriteRule</span> .*\.(jpe?g|gif|bmp|png)$ - [F]</pre></div></div>

<p>Si tenemos <strong>cPanel</strong> es bastante simple hacer esto, porque en <strong>Security</strong> tiene una opción para configurar la protección contra el hotlinking; si no, podemos utilizar <a href="http://www.htaccesstools.com/hotlink-protection/">este</a> asistente web que nos permite configurar las opciones y nos genera el código.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/02/cpanel-hotlink.png' alt='cPanel - Hotlink Protection' border='0' /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-evitar-el-hotlinking-con-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Programa de Ventajas de Windows Original&#8221;</title>
		<link>http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/</link>
		<comments>http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 10:34:52 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[wga]]></category>
		<category><![CDATA[windows genuine advantage]]></category>
		<category><![CDATA[windows original]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/</guid>
		<description><![CDATA[Windows Genuine Advantage (WGA) es un sistema antipiratería creado por Microsoft que impone al usuario validar la autenticidad del sistema operativo Windows cuando intenta acceder diferentes servicios como actualizaciones o descargas. En la mayoría de los casos, el &#8220;Programa de Ventajas de Windows Original&#8221; se instala como una actualización y pasa desapercibida. Si nuestro sistema [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Windows Genuine Advantage</strong> (WGA) es un sistema antipiratería creado por <strong>Microsoft</strong> que impone al usuario validar la autenticidad del sistema operativo Windows cuando intenta acceder diferentes servicios como actualizaciones o descargas.</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/01/wga.png' alt='WGA - Inicio Windows' /></p>
<p>En la mayoría de los casos, el &#8220;Programa de Ventajas de Windows Original&#8221; se instala como una actualización y pasa desapercibida. Si nuestro sistema no es original, el WGA lo detectará y saldrán continuamente molestos mensajes como este:</p>
<p><img src='http://www.bujorel.net/wp-content/uploads/2008/01/wga_barra.png' alt='WGA - Barra de tareas' />&#8220;<strong>Podría ser víctima de una falsificación de software</strong>.<br />
Esta copia de Windows no ha superado el proceso de validación original de Windows. Haga click aquí y obtendrá ayuda para este problema. (Obtener Windows original | Más detalles).</p>
<p>También se han dado casos de falsos positivos &#8211; Windows originales que no han pasado la validación.<br />
Para quitar el mensaje y asi poder actualizar Windows correctamente y realizar las descargas de Microsoft Download Center hay que hacer lo siguiente:<br />
<span id="more-55"></span>· Descargar <a href="http://www.bujorel.net/proxy/proxy.php?file=Windows.Genuine.Advantage.Validation.v1.9.40.0.rar">este archivo</a> y extraerlo<br />
· Ejecutar <strong>instalar.bat</strong><br />
· Reiniciar el ordenador</p>
<p>El archivo <strong>Windows Genuine Advantage Validation v1.9.40.0.rar</strong> incluye los tres archivos del WGA modificados.<br />
Si necesitamos validar, el archivo <strong>LegitCheckControl.dll</strong> que es la base, lo hará sin ningún problema.<br />
El archivo <strong>instalar.bat</strong> lo que hace primero es cerrar el proceso <strong>wgatray.exe</strong> que es el responsable de los continuos mensajes de advertencia.</p>
<div align="center"><img src='http://www.bujorel.net/wp-content/uploads/2008/01/wga_icono.png' alt='WGA - Mensaje icono' /></div>
<p></p>
<p>Después intenta eliminar antiguas copias de seguridad (.bak) y seguido crea unas nuevas copias de seguridad con los archivos en su ultima versión:<br />
· LegitCheckControl.dll<br />
· WgaLogon.dll<br />
· WgaTray.exe</p>
<p>Finalmente sustituye los archivos originales con los modificados.<br />
Para que esto tenga efecto hay que reiniciar el ordenador.</p>
<p><strong>Actualización</strong>: Marzo 2008 &#8211; versión <em>1.7.69.2</em>.<br />
<strong>Actualización</strong>: Septiembre 2008 &#8211; versión <em>1.8.31.0</em>.<br />
<strong>Actualización</strong>: Septiembre 2008 &#8211; versión <em>1.8.31.9</em>.<br />
<strong>Actualización</strong>: Octubre 2008 &#8211; versión <em>1.8.32.0</em>.<br />
<strong>Actualización</strong>: Noviembre 2008 &#8211; versión <em>1.8.32.1</em>.<br />
<strong>Actualización</strong>: Marzo 2009 &#8211; versión <em>1.9.40.0</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/programa-de-ventajas-de-windows-original/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
		<item>
		<title>Como pasar datos de MySQL a XML con PHP</title>
		<link>http://www.bujorel.net/tutorial/como-pasar-datos-de-mysql-a-xml-con-php/</link>
		<comments>http://www.bujorel.net/tutorial/como-pasar-datos-de-mysql-a-xml-con-php/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 14:30:49 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-pasar-datos-de-mysql-a-xml-con-php/</guid>
		<description><![CDATA[Este tutorial te mostrará como coger la información almacenada en una base de datos MySQL y pasarla a XML. Desde ahí puedes usar el XML como quieras. Esto puede ser útil para blogs, aplicaciones web, o incluso para CMS (Content Management Systems) para tu sitio o sitios web. Utilizar XML tiene muchas ventajas: • Es [...]]]></description>
			<content:encoded><![CDATA[<p>Este tutorial te mostrará como coger la información almacenada en una base de datos MySQL y pasarla a XML. Desde ahí puedes usar el XML como quieras. Esto puede ser útil para blogs, aplicaciones web, o incluso para CMS (Content Management Systems) para tu sitio o sitios web.</p>
<p><strong>Utilizar XML tiene muchas ventajas:</strong><br />
• Es extensible. Una vez diseñado un lenguaje, es posible extenderlo con la adición de nuevas etiquetas.<br />
• El analizador es un componente estándar, no es necesario crear un analizador específico.<br />
• Soporta Unicode.<br />
• Si un tercero decide usar un documento creado en XML, es sencillo entender su estructura y procesarlo. </p>
<p><strong>Preparar la base de datos</strong><br />
Lo bueno de esto es que no tendrás que cambiar la estructura de la base de datos existente. Los únicos cambios tendrás que hacerlos en el código PHP.<br />
Como es solo un ejemplo voy a incluir únicamente cuatro campos en la bbdd: <strong>id</strong>, <strong>nombre</strong>, <strong>email </strong>y <strong>texto </strong>y una tabla llamada <strong>tablaEjemplo</strong>.</p>
<p><strong>Código PHP</strong><br />
Primero hay que especificar para el navegador u otra aplicacion que usará este archivo, que lo interprete como XML y no como PHP.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>El segundo paso es especificar las variables para la conexión MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;usuario&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;contraseña&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$database</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;prueba&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Y ahora para hacer la conexión al servidor MySQL, utilizamos las variables establecidas antes:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$enlace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pass</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error MySQL.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error base de datos.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Una vez la conexión creada hay que ejecutar la <strong>query</strong> que deseamos. Posteriormente guardamos la consulta en la variable <strong>$resultado</strong>:<br />
<span id="more-54"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM tablaEjemplo ORDER BY id ASC&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$resultado</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Sin resultados.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Ahora hay que crear una variable XML de datos:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">$salida_xml = &quot;<span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span>\<span style="color: #0000ff;">&quot;1.0<span style="color: #000099; font-weight: bold;">\&quot;</span>?&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;informacion&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Las siguientes líneas son para el bucle que saca la información con la query y mantiene el bucle tanto como filas tiene nuestra base de datos.<br />
<strong>Mysql_fetch_assoc()</strong> toma la fila actual en la base de datos y lo exporta como una matriz (array) asociativa. Esto hace mas fácil hacer un seguimiento de nuestra información, porque cuando queremos sacar varios campos solo tendremos que poner <strong>$nombreMatriz['nombreCampo']</strong>.<br />
Las tres líneas que utilizan <strong>str_replace</strong> corrigen los caracteres incorrectos en XML que podrían causar fallos. La razón por la que solo se corrige la fila <strong>[texto]</strong> es porque es la única donde existe la posibilidad de contener esos caracteres.<br />
Para utilizar la información sacada de la base de datos hay que poner <strong>&#8220;$fila ['id']&#8220;</strong> entre las etiquetas XML.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
    <span style="color: #000088;">$fila</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&lt;persona&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;nombre&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nombre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/nombre&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;email&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/email&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
        <span style="color: #666666; font-style: italic;">// Corrigiendo caracteres incorrectos</span>
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;texto&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/texto&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&lt;/persona&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></div></div>

<p></p>
<p>Cierro los datos XML con la variable abierta antes:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/informacion&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Finalmente hay que poner la cadena de salida XML:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$salida_xml</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p><strong>Resultado final:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;usuario&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;contraseña&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$database</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;prueba&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$enlace</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pass</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error MySQL.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error base de datos.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM tablaEjemplo ORDER BY id ASC&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$resultado</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enlace</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Sin resultados.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;?xml version=<span style="color: #000099; font-weight: bold;">\&quot;</span>1.0<span style="color: #000099; font-weight: bold;">\&quot;</span>?&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;informacion&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
    <span style="color: #000088;">$fila</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&lt;persona&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;nombre&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nombre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/nombre&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;email&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/email&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
        <span style="color: #666666; font-style: italic;">// Corregiendo caracteres incorrectos</span>
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;lt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;texto&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'texto'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/texto&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
    <span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&lt;/persona&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$salida_xml</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/informacion&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$salida_xml</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p></p>
<p><strong>Consultas más exactas</strong><br />
También existe la posibilidad de hacer consultas más exactas.<br />
Especificando una variable, mediante un formulario o a través de la url:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Para formulario hay que usar POST</span>
<span style="color: #000088;">$varUnic</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'varUnic'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//Directamente desde la url con GET</span>
<span style="color: #000088;">$varUnic</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'varUnic'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
<p>Después de esto solo hay que modificar la <strong>query</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * FROM tablaEjemplo WHERE varUnic=<span style="color: #006699; font-weight: bold;">$varUnic</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-pasar-datos-de-mysql-a-xml-con-php/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Como subir videos de calidad a Youtube</title>
		<link>http://www.bujorel.net/tutorial/como-subir-videos-de-calidad-a-youtube/</link>
		<comments>http://www.bujorel.net/tutorial/como-subir-videos-de-calidad-a-youtube/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 23:29:02 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[calidad]]></category>
		<category><![CDATA[codificar]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[truco]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-subir-videos-de-calidad-a-youtube/</guid>
		<description><![CDATA[Hace poco ya anunciaron que iban a subir la calidad (probablemente en cuanto salga la ultima versión de Flash), pero mientras tanto se pueden subir vídeos con una calidad superior a la normal. En este momento se pueden subir vídeos FLV1 Flash en Youtube y que pasen por debajo del radar sin ser reconvertidos. Solo [...]]]></description>
			<content:encoded><![CDATA[<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2007/12/youtube-calidad.png" alt="Youtube Calidad" /></div>
<p></p>
<p>Hace poco ya anunciaron que iban a subir la calidad (probablemente en cuanto salga la ultima versión de Flash), pero mientras tanto se pueden subir vídeos con una calidad superior a la normal.</p>
<p>En este momento se pueden subir vídeos <strong>FLV1 Flash</strong> en Youtube y que pasen por debajo del radar sin ser reconvertidos. Solo vale FLV1, VP6 no funciona y será reconvertido.</p>
<p>El limite de Youtube es la duración y el bitrate. La duración tiene que ser como mucho <strong>10 minutos</strong>, aunque hasta 11 minutos funcionaria. El bitrate ha de ser siempre por debajo de <strong>350 Kbps</strong>. El archivo máximo seria de unos <strong>~27 MB</strong> aproximadamente.</p>
<p><strong>Requisitos:</strong><br />
• un vídeo (obvio) y si puede ser que tenga buena calidad<br />
• un codificador &#8211; yo he utilizado <a href="http://www.erightsoft.com/SUPER.html">Super ©</a> (basado en FFMpeg) que además es gratuito<br />
• un editor HEX &#8211; hay multitud (<a href="http://www.brixoft.net/download.asp#ID3">Hex Source</a>, que viene con Source Edit es gratuito)<br />
• <a href="http://mediainfo.sourceforge.net/es">MediaInfo</a> &#8211; para verificar la información de los archivos FLV antes de subirlos</p>
<p><strong>Primer paso &#8211; Convertir el archivo</strong><br />
Lo primero que hay que hacer es convertir el vídeo al formato adecuado.<br />
Youtube tiene el reproductor del tamaño de <strong>4/3</strong>.<br />
Si el video es 4/3 es muy simple. Si es panorámico tienes que hacer <a href="http://es.wikipedia.org/wiki/Letterbox">letterboxing</a>.<br />
También se puede reducir el framerate a 25 fps &#8211; (Youtube acepta hasta 30fps).<br />
La <a href="http://es.wikipedia.org/wiki/Frecuencia_de_muestreo">tasa de audio</a> tiene que ser <strong>11025</strong>, <strong>22050 </strong>ó <strong>44100</strong> &#8211; (ojo con esto, porqué muchos vídeos vienen con audio 48000 Hz).</p>
<p><span id="more-39"></span>El vídeo que voy a recodificar tiene 3:39 minutos.<br />
Estas son las opciones de Super ©:</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2007/12/super.png" title="Configuración Super ©"><img border="0" src="http://www.bujorel.net/wp-content/uploads/2007/12/super.thumbnail.png" alt="Configuración Super ©" /></a></div>
<p></p>
<p><strong>Segundo paso &#8211; Modificar el archivo</strong><br />
Ahora es cuando utilizaremos el editor HEX.<br />
Abrimos el archivo FLV en HEX y buscamos &#8220;duration&#8221;:</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2007/12/hex.png" title="HexSource"><img border="0" src="http://www.bujorel.net/wp-content/uploads/2007/12/hex.thumbnail.png" alt="HexSource" /></a></div>
<p></p>
<p>Lo que tenemos que modificar es un bloque de <strong>16 números</strong> que es justo después del número &#8220;40&#8243;.</p>
<p>Esta es una lista de valores HEX:<br />
4E00 = 1 minutos<br />
5E00 = 2 minutos<br />
6680 = 3 minutos<br />
6E00 = 4 minutos<br />
72C0 = 5 minutos<br />
7680 = 6 minutos<br />
7A40 = 7 minutos<br />
7E00 = 8 minutos<br />
80E0 = 9 minutos<br />
82C0 = 10 minutos<br />
849F = 10:59 minutos<br />
84A0 = 11 minutos<br />
Los primeros cuatro números son los de arriba, los demás son ceros.<br />
Ejemplo: 66 80 00 00 00 00 00 00 = 3 minutos.</p>
<p>Comparación entre dos el archivo FLV sin modificar y el modificado:</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2007/12/compar-hex.png" title="Comparación HexSource"><img border="0" src="http://www.bujorel.net/wp-content/uploads/2007/12/compar-hex.thumbnail.png" alt="Comparación HexSource" /></a></div>
<p></p>
<p>Antes de editarlo MediaInfo reportaba esto:</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2007/12/media-info-orig.png" title="MediaInfo FLV Original"><img border="0" src="http://www.bujorel.net/wp-content/uploads/2007/12/media-info-orig.png" alt="MediaInfo FLV Original" /></a></div>
<p></p>
<p>Después de editarlo:</p>
<div align="center"><a href="http://www.bujorel.net/wp-content/uploads/2007/12/media-info-hex.png" title="MediaInfo FLV HEX"><img border="0" src="http://www.bujorel.net/wp-content/uploads/2007/12/media-info-hex.png" alt="MediaInfo FLV HEX" /></a></div>
<p></p>
<p>Importante: lo de arriba es solo el vídeo y hay que sumar el bitrate del audio también. Aunque suele ser muy bajo hay que tener cuidado que el total no sobrepase los 350 Kbps.</p>
<p><strong>Tercer paso &#8211; Subir el vídeo</strong></p>
<p>Hay que subirlo directamente a Youtube, y probablemente esta vez no saldrá eso de &#8220;processing&#8221;.</p>
<p>Aquí esta el vídeo en cuestión:<br />
FLV1 &#8211; 640&#215;480 (4/3) &#8211; 912 Kbps &#8211; 25fps &#8211; Mp3 96 Kbps &#8211; 3:39 minutos</p>
<p><code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/p5Neked84fs"
			width="425"
			height="355">
	<param name="movie" value="http://www.youtube.com/v/p5Neked84fs" />
	<param name=wmode" value="transparent" />
</object></code><br />
<a href="http://es.youtube.com/watch?v=p5Neked84fs">Enlace a Youtube</a>.</p>
<p>También aquí unas ~30 segundos a mayor calidad:<br />
FLV1 &#8211; 640&#215;480 (4/3) &#8211; 2200 Kbps &#8211; 25fps &#8211; Mp3 112 Kbps &#8211; ~30 segundos</p>
<p><code>
<object	type="application/x-shockwave-flash"
			data="http://www.youtube.com/v/AQuHxPXRIQI"
			width="425"
			height="350">
	<param name="movie" value="http://www.youtube.com/v/AQuHxPXRIQI" />
	<param name=wmode" value="transparent" />
</object></code><br />
<a href="http://es.youtube.com/watch?v=AQuHxPXRIQI">Enlace a Youtube</a>.</p>
<p>Para verlos lo mejor es ponerlo en pausa y esperar a que cargue un poco.</p>
<p><strong>Editado:</strong><br />
Desde Febrero 2008 ya no funciona esto. Puede seguir usando Youtube con alta calidad siguiendo <a href="http://www.bujorel.net/informacion/alta-calidad-en-youtube/">este artículo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-subir-videos-de-calidad-a-youtube/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>Como actualizar FC4 a FC5 con Yum y Plesk 8</title>
		<link>http://www.bujorel.net/tutorial/como-actualizar-fc4-a-fc5-con-yum-y-plesk-8/</link>
		<comments>http://www.bujorel.net/tutorial/como-actualizar-fc4-a-fc5-con-yum-y-plesk-8/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 00:28:05 +0000</pubDate>
		<dc:creator>Bj</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[actualizar]]></category>
		<category><![CDATA[fedora core]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[plesk]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.bujorel.net/tutorial/como-actualizar-fc4-a-fc5-con-yum-y-plesk-8/</guid>
		<description><![CDATA[Necesitaba en un servidor una función de Apache &#8211; Large File Support &#8211; para poder descargar archivos mayores de 2 GB, y Apache 2.2 es el único que trae esa función. Así que opte por actualizar el Fedora Core 4 a Fedora Core 5, porque este ultimo trae Apache 2.2, MySQL 5, PHP 5 y [...]]]></description>
			<content:encoded><![CDATA[<div align="center"><img src="http://www.bujorel.net/wp-content/uploads/2007/11/fedora_core_5.png" alt="Fedora Core 5" /></div>
<p></p>
<p>Necesitaba en un servidor una función de Apache &#8211; <strong>Large File Support</strong> &#8211; para poder descargar archivos mayores de <strong>2 GB</strong>, y Apache 2.2 es el único que trae esa función. Así que opte por actualizar el Fedora Core 4 a Fedora Core 5, porque este ultimo trae <strong>Apache 2.2</strong>, <strong>MySQL 5</strong>, <strong>PHP 5</strong> y demás cosas actualizadas.</p>
<p>Todos los pasos son de una consola. Hace falta una conexión a Internet decente para que funcione en tiempo real.<br />
Estos son los pasos a seguir:</p>
<p>1. Obtén el <strong>Yum</strong>. Si no lo tienes, ejecuta estos comandos:<br />
<em>cd /tmp<br />
wget </em><a target="_blank" href="ftp://download.fedora.redhat.com/pub/fedora/linux/core/4/SRPMS/yum-2.3.2-7.src.rpm" title="yum-2.3.2-7.src.rpm"><em>yum-2.3.2-7.src.rpm</em></a><br />
<em>rpm -Uvh yum-2.3.2-7.src.rpm</em></p>
<p>2. Instala la lista de repositorios para <strong>FC4</strong>:<br />
<em>wget </em><a target="_blank" href="http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/fedora-release-4-2.noarch.rpm" title="fedora-release-4-2.noarch.rpm"><em>fedora-release-4-2.noarch.rpm<br />
</em></a><em>rpm -Uvh fedora-release-4-2.noarch.rpm</em></p>
<p>3. Actualiza todo en la distribución <strong>FC4</strong>:<br />
<em>yum upgrade</em></p>
<p>4. Quita todos los kernels mas antiguos de <strong>2.6.17</strong>:<br />
<em>rpm -qa “*kernel*”<br />
yum remove kernel-2.6.17*<br />
yum remove kernel-devel-2.6.17*<br />
</em><br />
<span id="more-36"></span>5. Instala la lista de repositorios para <strong>FC5</strong>:<br />
<em>wget </em><a target="_blank" href="http://download.fedora.redhat.com/pub/fedora/linux/core/5/i386/os/Fedora/RPMS/fedora-release-5-5.noarch.rpm" title="fedora-release-5-5.noarch.rpm"><em>fedora-release-5-5.noarch.rpm</em></a><br />
<em>rpm -Uvh fedora-release-5-5.noarch.rpm</em></p>
<p>6. Actualiza el <strong>Yum</strong> &#8211; esto es un paso muy importante. El nuevo funcionará muchísimo mas rápido:<br />
<em>yum update yum</em></p>
<p>7. Añade los repositorios para <strong>PSA 8.3</strong>:<br />
Edita el archivo <strong>/etc/yum.conf</strong> y añade al final:<br />
<em>[atomic]<br />
name=Atomic Rocket Turtle &#8211; $releasever &#8211; Atomic PSA-Compatible RPMS<br />
baseurl=http://www.atomicorp.com/channels/atomic/fedora/$releasever/$basearch</p>
<p>[plesk]<br />
name=Plesk Server Administrator<br />
baseurl=http://www.atomicorp.com/channels/plesk/latest/fedora/$releasever/$basearch<br />
gpgcheck=0<br />
</em></p>
<p>8. Actualiza todo:<br />
<em>yum clean all<br />
yum upgrade</em></p>
<p>9. Es muy posible que falle alguna dependencia. Si el paso 8 falla ejecuta:<br />
<em>yum upgrade 2&gt;&amp;1 | tee /tmp/yum_upgrade</em></p>
<p>El fallo indica generalmente que el RPM instalado tiene alguna dependencia que no puede ser satisfecha con los paquetes del nuevo release de Fedora Core. Paquetes obsoletos o paquetes de terceros pueden causar este problema.Para ver una lista de los paquetes que necesitan ser quitados antes, ejecutamos:<br />
<em>perl -ne &#8216;print &#8220;$1\n&#8221; if ((/Error: Missing Dependency:.*is needed by package (.*)$/) || (/Error: Package (.*?) needs.*, this is not available./))&#8217;/tmp/yum_upgrade | sort | uniq</em></p>
<p>En mi caso he tenido que quitar los siguientes paquetes (con sus dependencias) para poder actualizar correctamente:<br />
<em>php51-curl<br />
php51-ftp<br />
php51-mysqli<br />
php51-openssl<br />
php51-pdo_mysql<br />
php-sqlite2<br />
sitebuilder-core<br />
sitebuilder_module-areamap<br />
sitebuilder_module-eshop<br />
sitebuilder_module-feedback<br />
sitebuilder_module-flashintro<br />
sitebuilder_module-forum<br />
sitebuilder_module-guestbook<br />
sitebuilder_module-login<br />
sitebuilder_module-rssreader<br />
sitebuilder_module-script<br />
sitebuilder_module-statistics<br />
sitebuilder_module-voting</em></p>
<p>Después volvemos al paso 8 y actualizamos.</p>
<p>10. Finalmente arreglamos la lista de <strong>rpm</strong> y <strong>SELinux</strong>. Después reiniciamos.<br />
<em>/sbin/fixfiles relabel<br />
rpm –rebuilddb<br />
reboot</em></p>
<p>Ahora tendremos el <strong>FC5 actualizado</strong> y con todo los parches de PHP. Si utilizas <strong>eaccelerator</strong> u otras extensiones PHP tendrás que instalarlas de nuevo, y también arreglar los archivos de configuración antes de reiniciar (httpd.conf, mysqld.conf, php.ini).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bujorel.net/tutorial/como-actualizar-fc4-a-fc5-con-yum-y-plesk-8/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
