<?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>erufenix .::. blog &#187; Programación</title>
	<atom:link href="http://erufenix.ingeenia.net/category/programacion/feed/" rel="self" type="application/rss+xml" />
	<link>http://erufenix.ingeenia.net</link>
	<description>Otro Blog de WordPress</description>
	<lastBuildDate>Wed, 07 Oct 2009 21:45:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Copiar archivos entre carpetas con PHP</title>
		<link>http://erufenix.ingeenia.net/copiar-archivos-entre-carpetas-con-php/</link>
		<comments>http://erufenix.ingeenia.net/copiar-archivos-entre-carpetas-con-php/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 21:16:18 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[archivos]]></category>
		<category><![CDATA[códigos]]></category>
		<category><![CDATA[comandos]]></category>
		<category><![CDATA[respaldos]]></category>

		<guid isPermaLink="false">http://erufenix.ingeenia.net/?p=1913</guid>
		<description><![CDATA[Digamos que queremos hacer un respaldo de archivos del servidor o copiar archivos de una ubicación a otra. Para esto este código nos puede servir.
En primera tenemos $dir y $dir2 que corresponden a la ruta origen y la ruta destino respectivamente, luego hacemos cambios a un script que ya había publicado antes, donde:

$dp=opendir($dir); abre el [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-videos/' rel='bookmark' title='Permanent Link: Has una página de vídeos'>Has una página de vídeos</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Digamos que queremos hacer un respaldo de archivos del servidor o copiar archivos de una ubicación a otra. Para esto este código nos puede servir.</p>
<p>En primera tenemos $dir y $dir2 que corresponden a la ruta origen y la ruta destino respectivamente, luego hacemos cambios a un script que ya había <a href="http://erufenix.ingeenia.net/has-una-pagina-de-videos/">publicado</a> antes, donde:</p>
<ul>
<li><b>$dp=opendir($dir);</b> abre el directorio para su lectura.</li>
<li><b>while($file=readdir($dp))</b> ciclo que lee el directorio mientras existan archivos en él.</li>
<li>Con <b>$extension=getExtension($file);</b> aplicamos un filtro para solo copiar archivos con ciertas extensiones</li>
<li>En la variable <b>$cmd</b> guardamos una cadena con el comando <a href="http://www.ibiblio.org/pub/linux/docs/LuCaS/Cursos/distro/intermedio/html/node21.html" target='_blank'>cp</a> con sus parametros y con la función <b><a href="http://mx.php.net/manual/en/book.exec.php" target='_blank'>exec()</a></b> ejecutamos el comando en el sistema. </li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getExtension<span style="color: #009900;">&#40;</span><span style="color: #000088;">$archivo</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
      	 <span style="color: #000088;">$a</span><span style="color: #339933;">=</span><span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$archivo</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      	 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$dir</span>  <span style="color: #339933;">=</span> getRuta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$CveCom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dir2</span> <span style="color: #339933;">=</span> getRuta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//verificamos que existe el directorio</span>
   <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br/&gt;Error... El directorio no existe. Configura bien tu variable <span style="color: #000099; font-weight: bold;">\&quot;</span>dir<span style="color: #000099; font-weight: bold;">\&quot;</span> ...&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;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//echo $dir;</span>
    <span style="color: #000088;">$dp</span><span style="color: #339933;">=</span><span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">=</span><span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//hacemos un ciclo para guardar los nombres de los directorios y archivos que se tienen en el directorio actual</span>
          <span style="color: #009900;">&#123;</span>
           <span style="color: #000088;">$extension</span><span style="color: #339933;">=</span>getExtension<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</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;">$extension</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;php&quot;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$extension</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;html&quot;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$extension</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;htm&quot;</span><span style="color: #009900;">&#41;</span>
	          <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$srcfile</span><span style="color: #339933;">=</span><span style="color: #000088;">$dir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #339933;">;</span>
		    <span style="color: #000088;">$dstfile</span><span style="color: #339933;">=</span><span style="color: #000088;">$dir2</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/&quot;</span><span style="color: #339933;">;</span>
		    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Copiar '<span style="color: #006699; font-weight: bold;">$srcfile</span>' a '<span style="color: #006699; font-weight: bold;">$dstfile</span>'... &lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
	            <span style="color: #000088;">$cmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;cp <span style="color: #006699; font-weight: bold;">$srcfile</span> <span style="color: #006699; font-weight: bold;">$dstfile</span>&quot;</span><span style="color: #339933;">;</span>
		    <span style="color: #000088;">$eje1</span><span style="color: #339933;">=</span><span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cmd</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return_var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #009900;">&#125;</span>
         <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Otra opción para copiar los archivos sería la función <a href="http://mx.php.net/manual/en/function.copy.php" target="_blank">copy()</a>, pero al ejecutar el script marcaba error al ejecutarse, así que decidi usar la alternativa del exec().</></p>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-videos/' rel='bookmark' title='Permanent Link: Has una página de vídeos'>Has una página de vídeos</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/copiar-archivos-entre-carpetas-con-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limpiar la consola de MySQL</title>
		<link>http://erufenix.ingeenia.net/limpiar-la-consola-de-mysql/</link>
		<comments>http://erufenix.ingeenia.net/limpiar-la-consola-de-mysql/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 23:46:35 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://erufenix.ingeenia.net/?p=1902</guid>
		<description><![CDATA[hace mucho que no posteo trucos y códigos de programación, pero creo que ya va siendo hora    .
Bueno al grano, para los que manejamos mysql en alguna ocasión nos hemos preguntado ¿Cómo limpio la consola de mysql?. Un caute dice dale muchos enters. Pero investigando en los foros de mysql me encontré [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/ver-los-videos-de-youtube-en-consola/' rel='bookmark' title='Permanent Link: Ver los vídeos de youtube en consola'>Ver los vídeos de youtube en consola</a></li><li><a href='http://erufenix.ingeenia.net/viva_mexico_mis_huevos_que/' rel='bookmark' title='Permanent Link: Viva México, mis huevos que'>Viva México, mis huevos que</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>hace mucho que no posteo trucos y códigos de programación, pero creo que ya va siendo hora  <img src='http://erufenix.ingeenia.net/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' />  .</p>
<p>Bueno al grano, para los que manejamos <a href="http://es.wikipedia.org/wiki/MySQL" target='_blank'>mysql</a> en alguna ocasión nos hemos preguntado ¿Cómo limpio la consola de mysql?. Un caute dice dale muchos enters. Pero investigando en los <a href="http://forums.mysql.com/" target='_blank'>foros</a> de mysql me encontré 2 formas de hacerlo:</p>
<p><span>1. Con el comando</span></p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">\<span style="color: #CC0099;">!</span> clear<span style="color: #000033;">;</span></pre></div></div>

<p><span>2. Con el atajo de teclado</span></p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">ctrl <span style="color: #CC0099;">+</span> l</pre></div></div>



<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/ver-los-videos-de-youtube-en-consola/' rel='bookmark' title='Permanent Link: Ver los vídeos de youtube en consola'>Ver los vídeos de youtube en consola</a></li><li><a href='http://erufenix.ingeenia.net/viva_mexico_mis_huevos_que/' rel='bookmark' title='Permanent Link: Viva México, mis huevos que'>Viva México, mis huevos que</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/limpiar-la-consola-de-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ebooks de autómatas</title>
		<link>http://erufenix.ingeenia.net/ebooks-de-automatas/</link>
		<comments>http://erufenix.ingeenia.net/ebooks-de-automatas/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 16:07:47 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[ebook y book]]></category>

		<guid isPermaLink="false">http://erufenix.ingeenia.net/?p=976</guid>
		<description><![CDATA[Este 4trimestre de la maestría estoy tomando una clase en la que se ven autómatas, dando un googlaso por la red me encontré estos 2 ebooks.

El primer libro Autómatas y Lenguajes: Un enfoque de diseño fue diseñado por Ramon F. Brena Pinero, profesor en el Tecnológico de Monterrey, Campus Monterrey quein impartió clases relacionadas con [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/ebook-de-flash/' rel='bookmark' title='Permanent Link: ebooks de flash'>ebooks de flash</a></li><li><a href='http://erufenix.ingeenia.net/ebooks-comandos-de-linux/' rel='bookmark' title='Permanent Link: ebooks comandos de linux'>ebooks comandos de linux</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Este 4trimestre de la maestría estoy tomando una clase en la que se ven <a href="http://es.wikipedia.org/wiki/Teor%C3%ADa_de_aut%C3%B3matas">autómatas</a>, dando un googlaso por la red me encontré estos 2 ebooks.</p>
<div align='center'><img src="http://erufenix.ingeenia.net/images/ebooks.png" width="320" height="360" alt="ebooksaotomatas" title="" /></div>
<p>El primer libro <a href="http://homepages.mty.itesm.mx/rbrena/AyL.html">Autómatas y Lenguajes: Un enfoque de diseño</a> fue diseñado por Ramon F. Brena Pinero, profesor en el Tecnológico de Monterrey, Campus Monterrey quein impartió clases relacionadas con Autómatas y lenguajes por mas de 10 años</p>
<p>El segundo es un clásico sobre los lenguajes formales, la teoría de autómatas y la complejidad computacional. Con más énfasis en las aplicaciones prácticas actuales, con un estilo más conciso y directo y numerosos ejercicios y ejemplos que le ayudan a confirmar la comprensión de los conceptos teóricos presentados.</p>
Note: There is a file embedded within this post, please visit this post to download the file.


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/ebook-de-flash/' rel='bookmark' title='Permanent Link: ebooks de flash'>ebooks de flash</a></li><li><a href='http://erufenix.ingeenia.net/ebooks-comandos-de-linux/' rel='bookmark' title='Permanent Link: ebooks comandos de linux'>ebooks comandos de linux</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/ebooks-de-automatas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Problema con swfobject y update de flash en ie7</title>
		<link>http://erufenix.ingeenia.net/problema-con-swfobject-y-update-de-flash-en-ie7/</link>
		<comments>http://erufenix.ingeenia.net/problema-con-swfobject-y-update-de-flash-en-ie7/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 18:16:14 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/problema-con-swfobject-y-update-de-flash-en-ie7</guid>
		<description><![CDATA[Para los que no saben existe algo llamado swfobject que es un script que sirve para añadir de forma fácil y segura animaciones flash en una pagina y este script es el que uso yo.
Vamos al grano resulta que hoy abrí mi blog con el chafasplorer 7 y como no tenia el plugin de flash [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/trs_sw/' rel='bookmark' title='Permanent Link: Probando swfObject'>Probando swfObject</a></li><li><a href='http://erufenix.ingeenia.net/ebook-de-flash/' rel='bookmark' title='Permanent Link: ebooks de flash'>ebooks de flash</a></li><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Para los que no saben existe algo llamado <a href="http://blog.deconcept.com/swfobject/">swfobject</a> que es un script que sirve para añadir de forma fácil y segura animaciones flash en una pagina y este script es el que uso yo.</p>
<p>Vamos al grano resulta que hoy abrí mi blog con el chafasplorer 7 y como no tenia el plugin de flash pues entonces lo instale pero al reiniciar, sopas ninguna animación flash se visualizaba.</p>
<p>El problema se presenta al actualizar el plugin de flash para chafasplorer 7 el swfobject ya no funciona bien. Gogleando por la red encontré la <a href="http://www.forosdelweb.com/f16/swfobject-deja-funcionar-tras-update-flash-557974/">solución</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> so <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> SWFObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;animacion.swf&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;sotester&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;743&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;133&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;8&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;#0000FF&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Cambiar por:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> so <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> SWFObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;animacion.swf&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;sotester&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;743&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;133&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;false&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;#0000FF&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Como ven solo se cambia el parámetro de la vercion de flash por false.</p>
<p>Por favor ya dejen de usar chafasplorer  para navegar, ya dejen eso navegador lento e inseguro y que además no cumple con los estandares web, mejor&#8230; <a href="http://www.mozilla.com/en-US/">get firefox</a></p>
<p align="center"><img src="http://securebrowsing.org/images/ff_vs_ie.jpg"/></p>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/trs_sw/' rel='bookmark' title='Permanent Link: Probando swfObject'>Probando swfObject</a></li><li><a href='http://erufenix.ingeenia.net/ebook-de-flash/' rel='bookmark' title='Permanent Link: ebooks de flash'>ebooks de flash</a></li><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/problema-con-swfobject-y-update-de-flash-en-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Has una página de rolas</title>
		<link>http://erufenix.ingeenia.net/has-una-pagina-de-rolas/</link>
		<comments>http://erufenix.ingeenia.net/has-una-pagina-de-rolas/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 08:14:49 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/has-una-pagina-de-rolas</guid>
		<description><![CDATA[Hace unos post publique post de como organizar y visualizar los vídeos FLV almacenados en nuestro server; en esta ocasión veremos como organizar mp3.
Básicamente el código es el mismo, pero con unas modificaciones.

Ver código modificado


ocultar



$contenido = '&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;playlist version=&#34;1&#34; xmlns=&#34;http://xspf.org/ns/0/&#34;&#62;
	&#60;trackList&#62;';
while($file=readdir($dp))
       {
        [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-videos/' rel='bookmark' title='Permanent Link: Has una página de vídeos'>Has una página de vídeos</a></li><li><a href='http://erufenix.ingeenia.net/copiar-archivos-entre-carpetas-con-php/' rel='bookmark' title='Permanent Link: Copiar archivos entre carpetas con PHP'>Copiar archivos entre carpetas con PHP</a></li><li><a href='http://erufenix.ingeenia.net/generar-un-xml-con-php/' rel='bookmark' title='Permanent Link: Generar un XML con php'>Generar un XML con php</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Hace unos post publique <a href="http://erufenix.codesys.org/has-una-pagina-de-videos">post</a> de como organizar y visualizar los vídeos <a href="http://es.wikipedia.org/wiki/FLV">FLV</a> almacenados en nuestro server; en esta ocasión veremos como organizar mp3.</p>
<p>Básicamente el código es el mismo, pero con unas modificaciones.</p>
<div id="status1-codr1">
<a href="javascript:oculta3('codr1');">Ver código modificado</a>
</div>
<div id="status2-codr1" class="show" >
<a href="javascript:oculta3('codr1');">ocultar</a>
</div>
<div id="codr1" class="show">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">$contenido = '<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>
&lt;playlist version=&quot;1&quot; xmlns=&quot;http://xspf.org/ns/0/&quot;&gt;
	&lt;trackList&gt;';
while($file=readdir($dp))
       {
        $extension=getExtension($file);
	      if($extension==&quot;mp3&quot;)
	         {
                  $filenames[]=$file;
                }
       }
sort($filenames);
for($i=0;$i&lt;count($filenames);$i++)
    {
     $ruta=$referer.&quot;/&quot;.$filenames[$i];
     $rolaname=substr($filenames[$i],0,-4);
     $se=sepcade($rolaname);
		 $contenido.='
&lt;track&gt;
&lt;title&gt;'.$se.'&lt;/title&gt;
&lt;creator&gt;&lt;/creator&gt;
&lt;location&gt;'.$ruta.'&lt;/location&gt;
&lt;/track&gt;';
}</pre></div></div>

</div>
<p>Otro cambio que hice fue en la parte en que se escribe el archivo el XML, ya que aun cambiando los permisos del archivo (mod 777) no se escribía el valor de contenido en el archivo, pero con el sig. código se soluciono.</p>
<div id="status1-codr2">
<a href="javascript:oculta3('codr2');">Ver código de archivos</a>
</div>
<div id="status2-codr2" class="show" >
<a href="javascript:oculta3('codr2');">ocultar</a>
</div>
<div id="codr2" class="show">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_writable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$archivo</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// En nuestro ejemplo estamos abriendo $nombre_archivo en modo de adición.</span>
    <span style="color: #666666; font-style: italic;">// El apuntador de archivo se encuentra al final del archivo, asi que</span>
    <span style="color: #666666; font-style: italic;">// alli es donde ira $contenido cuando llamemos fwrite().</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$gestor</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$archivo</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wb'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		     <span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No se puede abrir el archivo (<span style="color: #006699; font-weight: bold;">$archivo</span>)&quot;</span><span style="color: #339933;">;</span>
          <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// Escribir $contenido a nuestro arcivo abierto.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$gestor</span><span style="color: #339933;">,</span> <span style="color: #000088;">$contenido</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
		    <span style="color: #009900;">&#123;</span>
         <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No se puede escribir al archivo (<span style="color: #006699; font-weight: bold;">$archivo</span>)&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
		 <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$gestor</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

</div>
<p>El resultado lo puedes ver en esta <a href="http://erufenix.codesys.org/rolas/index.php" title="Mis rolas" rel="gb_page_fs[]">página</a> y el código completo <a href="http://erufenix.codesys.org/rolas/source.php" title="Código" rel="gb_page_fs[]">aquí</a></p>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-videos/' rel='bookmark' title='Permanent Link: Has una página de vídeos'>Has una página de vídeos</a></li><li><a href='http://erufenix.ingeenia.net/copiar-archivos-entre-carpetas-con-php/' rel='bookmark' title='Permanent Link: Copiar archivos entre carpetas con PHP'>Copiar archivos entre carpetas con PHP</a></li><li><a href='http://erufenix.ingeenia.net/generar-un-xml-con-php/' rel='bookmark' title='Permanent Link: Generar un XML con php'>Generar un XML con php</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/has-una-pagina-de-rolas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash + php + mysql</title>
		<link>http://erufenix.ingeenia.net/flash-php-mysql/</link>
		<comments>http://erufenix.ingeenia.net/flash-php-mysql/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 20:11:53 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/155</guid>
		<description><![CDATA[Hace unos post publique como utilizar flash + php, esta ocasión veremos como hacer conexión con una BD de mysql.
Empecemos por hacer una página php que contenga las instrucciones para hacer la conexión con la BD y funciones básicas como altas, bajas, búsqueda y modificaciones.

Base usada en el ejemplo


CREATE TABLE `agenda` &#40;
  `id` int&#40;11&#41; [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php/' rel='bookmark' title='Permanent Link: Flash + php'>Flash + php</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li><li><a href='http://erufenix.ingeenia.net/problema-con-swfobject-y-update-de-flash-en-ie7/' rel='bookmark' title='Permanent Link: Problema con swfobject y update de flash en ie7'>Problema con swfobject y update de flash en ie7</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Hace unos post publique como utilizar <a href="http://erufenix.codesys.org/flash-php">flash + php</a>, esta ocasión veremos como hacer conexión con una BD de <a href="http://es.wikipedia.org/wiki/Mysql">mysql.</a></p>
<p>Empecemos por hacer una página php que contenga las instrucciones para hacer la conexión con la BD y funciones básicas como altas, bajas, búsqueda y modificaciones.</p>
<ul>
<li>Base usada en el ejemplo</li>
</ul>

<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;">`agenda`</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;">`nombre`</span> <span style="color: #000099;">char</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">30</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">collate</span> latin1_general_ci <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;">`fon`</span> <span style="color: #000099;">char</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">collate</span> latin1_general_ci <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: #990099; font-weight: bold;">PRIMARY KEY</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>latin1 <span style="color: #CC0099; font-weight: bold;">COLLATE</span><span style="color: #CC0099;">=</span>latin1_general_ci<span style="color: #000033;">;</span></pre></div></div>

<ul>
<li>Conexión</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$DBhost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBuser</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;usuario_de_la_base&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBpass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;password_de_la_base&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;nombre_de_la_base&quot;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// conectando al servidor MySQL</span>
<span style="color: #000088;">$DBConn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DBhost</span><span style="color: #339933;">,</span><span style="color: #000088;">$DBuser</span><span style="color: #339933;">,</span><span style="color: #000088;">$DBpass</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 en conexión: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// selección de la base</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DBName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBConn</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 al seleccionar la base: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<ul>
<li>altas, bajas, etc.</li>
</ul>
<div id="fbdo" class="show">

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$accion</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'regi'</span><span style="color: #339933;">:</span>
	  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nombre</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;  &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fon</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$consulta</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;INSERT INTO `agenda` (`nombre`, `fon`) VALUES('<span style="color: #006699; font-weight: bold;">$nombre</span>','<span style="color: #006699; font-weight: bold;">$fon</span>');&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;">$consulta</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 en la consulta&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'leer'</span><span style="color: #339933;">:</span>
	    <span style="color: #000088;">$consulta</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT * FROM `agenda`;&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;">$consulta</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 en la consulta&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #000088;">$nfilas</span><span style="color: #339933;">=</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: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;filas=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$nfilas</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&amp;registros=&quot;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fila</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		    <span style="color: #009900;">&#123;</span>
		     <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Nombre:&lt;/b&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;b&gt;Teléfono:&lt;/b&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'busca'</span><span style="color: #339933;">:</span>
	     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$crite</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;byname&quot;</span><span style="color: #009900;">&#41;</span>
	        <span style="color: #009900;">&#123;</span>
                   <span style="color: #000088;">$consulta</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT * FROM `agenda` WHERE `nombre`='<span style="color: #006699; font-weight: bold;">$valor</span>';&quot;</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: #000088;">$crite</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;byfon&quot;</span><span style="color: #009900;">&#41;</span>
	        <span style="color: #009900;">&#123;</span>
                  <span style="color: #000088;">$consulta</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT * FROM `agenda` WHERE `fon`=<span style="color: #006699; font-weight: bold;">$valor</span> ;&quot;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</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;">$consulta</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 en la consulta&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&amp;buscar=&quot;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fila</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resultado</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	            <span style="color: #009900;">&#123;</span>
		      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;b&gt;Nombre:&lt;/b&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;b&gt;Teléfono:&lt;/b&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fila</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br&lt;br /&gt;'</span>
                    <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>En esta código usaremos la sentencia <a href="http://www.php.net/manual/es/control-structures.switch.php">switch</a> para realizar las diferentes operaciones de la BD, los valores de la variable $accion se mandaran desde flash</p>
<p>En flash creamos un campo de texto dinámico en el cual cargaremos los registros de la base, para esto utilizaremos la instrucciones loadvars, load y onload para poner el valor de $accion=leer y así llamar a dicha función en la pagina php.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> leer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
       <span style="color: #66cc66;">&#123;</span>
	  regis=<span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LoadVars</span>;
          regis.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">_global</span>.<span style="color: #006600;">server</span>+<span style="color: #ff0000;">&quot;phpf/agenda.php?accion=leer&quot;</span><span style="color: #66cc66;">&#41;</span>;
          regis.<span style="color: #0066CC;">onLoad</span>=<span style="color: #000000; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		 <span style="color: #66cc66;">&#123;</span>
                   registro.<span style="color: #0066CC;">htmlText</span>=<span style="color: #0066CC;">this</span>.<span style="color: #006600;">registros</span>;
                 <span style="color: #66cc66;">&#125;</span>
      <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>
Donde regis es la variable que guarda el resultado de la acción leer de la pagina php, registro es el campo dinamico que mostrara los resultados y _global.server tiene el valor del host donde se ejecuta el script php.
</p>
<p>
Para insertar registros, creamos 2 campos tipo input, usamos la sentencia sendAndLoad la cual carga los valores contenidos en un objeto LoadVars (datos para este ejemplo) y los envía mediante la URl al servidor.
</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">datos = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">LoadVars</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
datos.<span style="color: #006600;">nombre</span> = nom;
datos.<span style="color: #006600;">fon</span> = fo;
<span style="color: #000000; font-weight: bold;">function</span> registra<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
       <span style="color: #66cc66;">&#123;</span>
        datos.<span style="color: #0066CC;">sendAndLoad</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">_global</span>.<span style="color: #006600;">server</span> + <span style="color: #ff0000;">&quot;phpf/agenda.php?accion=regi&quot;</span>, datos, <span style="color: #ff0000;">&quot;POST&quot;</span><span style="color: #66cc66;">&#41;</span>;
        datos.<span style="color: #0066CC;">onLoad</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>success<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>success<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
				nombre.<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span>;
				fon.<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;&quot;</span>;
				msg.<span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Datos registrados&quot;</span>;
				<span style="color: #66cc66;">&#125;</span>
		      <span style="color: #66cc66;">&#125;</span>
     <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>
Donde datos.nombre = nom contiene el valor del primer campo tipo input, y datos.fon = fo el valor del segundo campo.
</p>
<p>Teniendo estas dos funciones (leer e insertar) y con un poco de más de programación e imaginación podemos implementar las opciones de eliminación y búsqueda.</p>
<p><a href="http://erufenix.codesys.org/descargas/flash_exa/phpf.rar" title="phpf.rar" target="_self">archivos del ejemplo</a></p>
<p id="fbd" align="center">22</p>
<p><script type="text/javascript">
	var fbd = new SWFObject("http://erufenix.codesys.org/phpf/registra2.swf","single","480","400","8");
       fbd.write("fbd");
</script>
</div>
<div id="status1-fbdo">
<a href="javascript:oculta3('fbdo');">Seguir leyendo</a>
</div>
<div id="status2-fbdo" class="show" >
<a href="javascript:oculta3('fbdo');">ocultar</a>
</div>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php/' rel='bookmark' title='Permanent Link: Flash + php'>Flash + php</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li><li><a href='http://erufenix.ingeenia.net/problema-con-swfobject-y-update-de-flash-en-ie7/' rel='bookmark' title='Permanent Link: Problema con swfobject y update de flash en ie7'>Problema con swfobject y update de flash en ie7</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/flash-php-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ecriptar password</title>
		<link>http://erufenix.ingeenia.net/md5/</link>
		<comments>http://erufenix.ingeenia.net/md5/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 02:26:23 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/md5</guid>
		<description><![CDATA[Existen varias maneras de ecriptar password en un formulario, las más fácil es usar códigos de ecriptación ya definidos como : SHA-1, MD4 o MD5
En php existe una función md5() que cumple con esta tarea, pero el inconveniente es que lo hace en el lado del servidor, lo que significa que del cliente al servidor [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Existen varias maneras de ecriptar password en un formulario, las más fácil es usar códigos de ecriptación ya definidos como : <a href="http://es.wikipedia.org/wiki/SHA">SHA-1</a>, <a href="http://es.wikipedia.org/wiki/MD4">MD4</a> o <a href="http://es.wikipedia.org/wiki/MD5">MD5</a></p>
<p>En php existe una función <a href="http://www.php.net/manual/es/function.md5.php">md5()</a> que cumple con esta tarea, pero el inconveniente es que lo hace en el lado del servidor, lo que significa que del cliente al servidor la clave viaja en forma plana.</p>
<p>Para solucionar esto esta su equivalente en <a href="http://pajhome.org.uk/crypt/md5/">java script</a> con el cual podemos los valores de los campos de un formulario y mandarlo directamente en md5 del cliente al servidor.</p>
<p>
ejemplo:
</p>
<p>
<label for="pass">pass:</label><br />
<input name="cmd5" type="text" size="20" id="cmd5"/>
<a href="#" onclick="javascript:(alert(hex_md5(document.getElementById('cmd5').value)));">Valor en MD5</a>
</p>
<p>codigo:</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;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span>&gt;</span>Texto aquí:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cmd5&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cmd5&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
<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;#&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:(alert(hex_md5(document.getElementById('cmd5').value)));&quot;</span>&gt;</span>Valor en MD5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

<div id="status1-md">
<a href="javascript:oculta3('md');">Uso en formularios</a>
</div>
<div id="status2-md" class="show" >
<a href="javascript:oculta3('md');">ocultar</a>
</div>
<div id="md" class="show">
Para usar la ecriptación en los formularios podemos hacerlo de dos formas, la primera como lo mencionan en la <a href="http://pajhome.org.uk/crypt/md5/auth.html">pagina del autor </a> y la segunda es crear un campo oculto y usar el método onSubmit().</p>
<p>Donde el campo falso contiene el valor que se cifrara en md5 y el campo oculto es el valor que enviara como password</p>
<p>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;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'una_page.php'</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">onSubmit</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return checkData()&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;forc&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user&quot;</span>&gt;</span>Usuario:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&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;">p</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--Campo falso--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span>&gt;</span>Password<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;passwordmd5&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&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;">p</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--Campo oculto--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span>    <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;40&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;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">align</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;center&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Entrar&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;enviar&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;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>Javascript</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> checkData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    document.<span style="color: #660066;">forc</span>.<span style="color: #660066;">password</span>.<span style="color: #660066;">value</span><span style="color: #339933;">=</span>hex_md5<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">forc</span>.<span style="color: #660066;">passwordmd5</span>.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

</div>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/md5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Páginas seguras con PHPsp</title>
		<link>http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/</link>
		<comments>http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 23:14:31 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/paginas-seguras-con-phpsp</guid>
		<description><![CDATA[Si tu eres desarrollador de aplicaciones en php y se te complica hacer la sección de identificación y logeo, phpsp es tu solución
Phpsp es una serie de scripts escritas en php que de manera fácil y sencilla crean un sistema de logeo e identificación para una aplicación php. Características

Seguridad fácil para las páginas
Crear diferentes grupos [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/md5/' rel='bookmark' title='Permanent Link: Ecriptar password'>Ecriptar password</a></li><li><a href='http://erufenix.ingeenia.net/galeria-para-word-press/' rel='bookmark' title='Permanent Link: Galería de fotos para WordPress'>Galería de fotos para WordPress</a></li><li><a href='http://erufenix.ingeenia.net/mira_ama_sin_indexphp/' rel='bookmark' title='Permanent Link: Mira ama sin index.php'>Mira ama sin index.php</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Si tu eres desarrollador de aplicaciones en php y se te complica hacer la sección de identificación y logeo, phpsp es tu solución</p>
<p><a href="http://www.phpsecurepages.com">Phpsp</a> es una serie de scripts escritas en php que de manera fácil y sencilla crean un sistema de logeo e identificación para una aplicación php. Características</p>
<ul>
<li>Seguridad fácil para las páginas</li>
<li>Crear diferentes grupos de usuarios cada con sus propios permisos</li>
<li>Puede usarse con o sin base de datos</li>
<li>Manejo de sesiones</li>
<li>Soporte multilenguaje</li>
<li>Interfaz personalizable</li>
<li>Trabaja con php3, php4, php5</li>
</ul>
<div id="status1-phps">
<a href="javascript:oculta3('phps');">Instalación, configuración y uso</a>
</div>
<div id="status2-phps" class="show" >
<a href="javascript:oculta3('phps');">ocultar</a>
</div>
<div id="phps" class="show">
<div class="entry_int">
<p><b>· Instalación</b></p>
<ul>
<li><span>1. </span>Descomprimir phpSecurePages en la aplicación o en servidor</li>
<li><span>2. </span>Configurar el archivo secure.php</li>
</ul>
<p><span>Ejecutar el sig. script si vas a usar BD</span></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> phpSP_users <span style="color: #FF00FF;">&#40;</span>
primary_key <span style="color: #999900; font-weight: bold;">MEDIUMINT</span> <span style="color: #FF9900; font-weight: bold;">UNSIGNED</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: #000099;">user</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">50</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: #000033;">,</span>
<span style="color: #000099;">password</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">32</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: #000033;">,</span>
userlevel <span style="color: #999900; font-weight: bold;">TINYINT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">3</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
<span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span>primary_key<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
<span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #000099;">user</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p><b>· Configuración</b></p>
<p>Editar el archivo secure.php y modificar los siguientes parámetros</p>
<ul>
<li><b>$cfgIndexpag</b>: página inicial del sitio</li>
<li><b>$languageFile</b>: lenguaje de phpsp</li>
<li><b>$useDatabase</b>: en true, para usar BD</li>
</ul>
<p>Más info de la configuración <a href="http://www.phpsecurepages.com/readme.php">aqui</a></p>
<p><b>· Uso</b></p>
<p>Poner el siguiente código al inicio de tus páginas</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: #000088;">$cfgProgDir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'phpSecurePages/'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfgProgDir</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;secure.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</div>
<p><a href="http://www.phpsecurepages.com/test/test.php">Ejemplo de phpsp</a></p>
</div>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/md5/' rel='bookmark' title='Permanent Link: Ecriptar password'>Ecriptar password</a></li><li><a href='http://erufenix.ingeenia.net/galeria-para-word-press/' rel='bookmark' title='Permanent Link: Galería de fotos para WordPress'>Galería de fotos para WordPress</a></li><li><a href='http://erufenix.ingeenia.net/mira_ama_sin_indexphp/' rel='bookmark' title='Permanent Link: Mira ama sin index.php'>Mira ama sin index.php</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>show/hide en los post</title>
		<link>http://erufenix.ingeenia.net/showhide-en-los-post/</link>
		<comments>http://erufenix.ingeenia.net/showhide-en-los-post/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 06:32:31 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/showhide-en-los-post</guid>
		<description><![CDATA[Cuando escribo post muy largos en mi blog, no me gusta que estos ocupen una gran parte del blog; así que decidí investigar la manera de ocultar o mostrar parte del contenido.
Para word press hay muchos plugins que hacen esto, pero al probarlos no me gustaron ya que muchos de ellos recargan la pagina para [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/generar-un-xml-con-php/' rel='bookmark' title='Permanent Link: Generar un XML con php'>Generar un XML con php</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Cuando escribo post muy largos en mi blog, no me gusta que estos ocupen una gran parte del blog; así que decidí investigar la manera de ocultar o mostrar parte del contenido.</p>
<p>Para word press hay muchos plugins que hacen esto, pero al probarlos no me gustaron ya que muchos de ellos recargan la pagina para mostrar el contenido restante de un post. Así que mejor decidí implementar algo por mi cuenta.</p>
<div>
<p><b>1. </b>Empecemos por el css incluyendo el siguiente código.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.show</span>
  <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.hide</span>
  <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><b>2. </b>Con javascript usaremos el siguiente <a href="http://erufenix.codesys.org/js/xwindow.js">script</a> y el código.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> oculta3<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> elemento <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #003366; font-weight: bold;">var</span> state1<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;status1-&quot;</span><span style="color: #339933;">+</span>id<span style="color: #339933;">;</span>
   <span style="color: #003366; font-weight: bold;">var</span> state2<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;status2-&quot;</span><span style="color: #339933;">+</span>id<span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>elemento.<span style="color: #660066;">className</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
      elemento.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;hide&quot;</span><span style="color: #339933;">;</span>
      xDisplay<span style="color: #009900;">&#40;</span>state1<span style="color: #339933;">,</span><span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span>
      xDisplay<span style="color: #009900;">&#40;</span>state2<span style="color: #339933;">,</span><span style="color: #3366CC;">'block'</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">else</span>
    <span style="color: #009900;">&#123;</span>
      elemento.<span style="color: #660066;">className</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;show&quot;</span><span style="color: #339933;">;</span>
      xDisplay<span style="color: #009900;">&#40;</span>state1<span style="color: #339933;">,</span><span style="color: #3366CC;">'block'</span><span style="color: #009900;">&#41;</span>
      xDisplay<span style="color: #009900;">&#40;</span>state2<span style="color: #339933;">,</span><span style="color: #3366CC;">'none'</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span></pre></div></div>

<p><b>3. </b>En el html lo siguiente</p>
<div id="ocj" class="show">

<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;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;status1-nombre&quot;</span>&gt;</span>
<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;javascript:oculta3('nombre');&quot;</span>&gt;</span>mostrar<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;status2-nombre&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;show&quot;</span> &gt;</span>
<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;javascript:oculta3('nombre');&quot;</span>&gt;</span>ocultar<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nombre&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;show&quot;</span>&gt;</span>Contenido oculto<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>
El primer div indica el mensaje que se mostrara cuando el contenido este oculto, el segundo div muestra lo contrario y el tercer div es donde estará el contenido a ocultar. Donde &#8216;nombre&#8217; lo cambiaremos por el identificador del div que vayamos a usar.
</p>
</div>
</div>
<div id="status1-ocj">
<a href="javascript:oculta3('ocj');">Leer más&#8230;</a>
</div>
<div id="status2-ocj" class="show" >
<a href="javascript:oculta3('ocj');">Ocultar</a>
</div>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/generar-un-xml-con-php/' rel='bookmark' title='Permanent Link: Generar un XML con php'>Generar un XML con php</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/showhide-en-los-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generar un XML con php</title>
		<link>http://erufenix.ingeenia.net/generar-un-xml-con-php/</link>
		<comments>http://erufenix.ingeenia.net/generar-un-xml-con-php/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 06:36:44 +0000</pubDate>
		<dc:creator>erufenix</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programación]]></category>

		<guid isPermaLink="false">http://erufenix.codesys.org/generar-un-xml-con-php</guid>
		<description><![CDATA[Para este ejemplo vamos a crear un XML de la forma

&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;playlist version=&#34;1&#34; xmlns=&#34;http://xspf.org/ns/0/&#34;&#62;
&#60;trackList&#62;
&#60;track&#62;
&#60;title&#62;&#60;/title&#62;
&#60;creator&#62;&#60;/creator&#62;
&#60;location&#62;&#60;/location&#62;
&#60;/track&#62;
&#60;/trackList&#62;



1.Creamos una variable que contenga las primeras tres líneas del XML


$contenido='&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;playlist version=&#34;1&#34; xmlns=&#34;http://xspf.org/ns/0/&#34;&#62;
&#60;trackList&#62;';


2.Mediante un for llenamos los datos del xml: tile, creator y location. 


for&#40;$i=0;$i&#60;count&#40;$filenames&#41;;$i++&#41;&#123;
$contenido.='
   &#60;track&#62;
   &#60;title&#62;'.$se.'&#60;/title&#62;
   &#60;creator&#62;&#60;/creator&#62;
   &#60;location&#62;'.$ruta.'&#60;/location&#62;
   [...]


Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Para este ejemplo vamos a crear un <a href="http://es.wikipedia.org/wiki/XML">XML</a> de la forma</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;playlist</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://xspf.org/ns/0/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trackList<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;track<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;creator<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/creator<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;location<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/location<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/track<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trackList<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<div class="entry_int">
<ul>
<li><span>1.</span>Creamos una variable que contenga las primeras tres líneas del XML</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">$contenido='<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>
&lt;playlist version=&quot;1&quot; xmlns=&quot;http://xspf.org/ns/0/&quot;&gt;
&lt;trackList&gt;';</pre></div></div>

<ul>
<li><span>2.</span>Mediante un for llenamos los datos del xml: tile, creator y location. </li>
</ul>

<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;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filenames</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$contenido</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">'
   &lt;track&gt;
   &lt;title&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$se</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/title&gt;
   &lt;creator&gt;&lt;/creator&gt;
   &lt;location&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$ruta</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/location&gt;
   &lt;/track&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div id="oxml" class="show">
<ul>
<li><span>3.</span>Agregar a la variable las ultimas líneas después del for</li>
</ul>

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

<ul>
<li><span>4.</span>Por último para guardar el el valor de $contenido, lo hacemos con las siguientes funciones de archivo.</li>
</ul>
<pre lang ="php">
$file3=$dir."/archivo.xml";
$archivo=fopen($file,"w");
fwrite($archivo,utf8_encode($contenido));
fclose($archivo);
</pre>
<p>Para ver con más detalle el código <a href="http://erufenix.codesys.org/videos/explorador_videos.phps">aquí</a> y el xml generado <a href="http://erufenix.codesys.org/videos/rocklist.xml">aquí</a></p>
</div>
</div>
<div id="status1-oxml">
<p><a href="javascript:oculta3('oxml');">Leer más</a></p>
</div>
<div id="status2-oxml" class="show" >
<p><a href="javascript:oculta3('oxml');">ocultar</a></p>
</div>


<p>Related posts:<ol><li><a href='http://erufenix.ingeenia.net/has-una-pagina-de-rolas/' rel='bookmark' title='Permanent Link: Has una página de rolas'>Has una página de rolas</a></li><li><a href='http://erufenix.ingeenia.net/flash-php-mysql/' rel='bookmark' title='Permanent Link: Flash + php + mysql'>Flash + php + mysql</a></li><li><a href='http://erufenix.ingeenia.net/paginas-seguras-con-phpsp/' rel='bookmark' title='Permanent Link: Páginas seguras con PHPsp'>Páginas seguras con PHPsp</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://erufenix.ingeenia.net/generar-un-xml-con-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
