<?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>MixInformatico.com &#187; Php</title>
	<atom:link href="http://www.mixinformatico.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mixinformatico.com</link>
	<description>Reforzando tus ideas</description>
	<lastBuildDate>Sat, 31 Jul 2010 00:47:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Javascript – urlencode</title>
		<link>http://www.mixinformatico.com/2010/05/09/javascript-%e2%80%93-urlencode/</link>
		<comments>http://www.mixinformatico.com/2010/05/09/javascript-%e2%80%93-urlencode/#comments</comments>
		<pubDate>Mon, 10 May 2010 02:50:00 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Javascript – urlencode]]></category>
		<category><![CDATA[urlencode]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9243</guid>
		<description><![CDATA[Hay veces en que la función de javascript escape() no es suficiente, como por ejemplo si hay que codificar ‘?’. No sé exactamente cuando ni donde encontré esta función que imita el urldecode de PHP pero migrada a javascript, espero que les sea tan útil como a mi. 1 2 3 4 5 6 7 [...]]]></description>
			<content:encoded><![CDATA[<p>Hay veces en que la función de <strong>javascript </strong><strong>escape()</strong> no es suficiente, como por ejemplo si hay que codificar ‘?’. No sé  exactamente cuando ni donde encontré esta función que imita el <strong>urldecode </strong>de PHP pero migrada a <strong>javascript</strong>, espero que les sea tan útil como a mi.</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span> str <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">var</span> histogram <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> histogram_r <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> code <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> tmp_arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000000; font-weight: bold;">var</span> ret <span style="color: #339933;">=</span> str<span style="color: #339933;">.</span>toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">var</span> replacer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>search<span style="color: #339933;">,</span> replace<span style="color: #339933;">,</span> str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">var</span> tmp_arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 tmp_arr <span style="color: #339933;">=</span> str<span style="color: #339933;">.</span><span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span>search<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">return</span> tmp_arr<span style="color: #339933;">.</span><span style="color: #990000;">join</span><span style="color: #009900;">&#40;</span>replace<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// The histogram is identical to the one in urldecode.</span>
 histogram<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'!'</span><span style="color: #009900;">&#93;</span>   <span style="color: #339933;">=</span> <span style="color: #0000ff;">'%21'</span><span style="color: #339933;">;</span>
 histogram<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'%20'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'+'</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Begin with encodeURIComponent, which most resembles PHP's encoding functions</span>
 ret <span style="color: #339933;">=</span> encodeURIComponent<span style="color: #009900;">&#40;</span>ret<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>search in histogram<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 replace <span style="color: #339933;">=</span> histogram<span style="color: #009900;">&#91;</span>search<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 ret <span style="color: #339933;">=</span> replacer<span style="color: #009900;">&#40;</span>search<span style="color: #339933;">,</span> replace<span style="color: #339933;">,</span> ret<span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Custom replace. No regexing</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Uppercase for full PHP compatibility</span>
 <span style="color: #b1b100;">return</span> ret<span style="color: #339933;">.</span>replace<span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>\<span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>a<span style="color: #339933;">-</span>z0<span style="color: #339933;">-</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>g<span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>full<span style="color: #339933;">,</span> m1<span style="color: #339933;">,</span> m2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">+</span>m2<span style="color: #339933;">.</span>toUpperCase<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">return</span> ret<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/05/09/javascript-%e2%80%93-urlencode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Traducción Automatica con PHP</title>
		<link>http://www.mixinformatico.com/2010/05/09/traduccion-automatica-con-php/</link>
		<comments>http://www.mixinformatico.com/2010/05/09/traduccion-automatica-con-php/#comments</comments>
		<pubDate>Sun, 09 May 2010 16:36:20 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Traducción]]></category>
		<category><![CDATA[Traducción Automatica con PHP]]></category>
		<category><![CDATA[Traducción PHP]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9241</guid>
		<description><![CDATA[Cuando estamos desarrollando un sitio multiidioma, a veces, nos sería de lo más útil que el propio PHP nos hiciera una traducción de algunos contenidos, para guardarlos o para mostrarlos directamente. En cualquier caso hoy les dejo esta función que la verdad es bastante funcional cuando realizamos algún parseo. 1 2 3 4 5 6 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Cuando estamos desarrollando un sitio <strong>multiidioma</strong>,  a veces, nos sería de lo más útil que el propio PHP nos hiciera una <strong>traducción</strong> de algunos contenidos, para guardarlos o para mostrarlos directamente.</strong></p>
<p><strong>En cualquier caso hoy les dejo esta función que la verdad es bastante funcional cuando  realizamos algún parseo.</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*Hay que pasarle las siguientes variables:
$content -&gt; String a traducir
$ini -&gt; idioma desde el que queremos traducir
$fin -&gt; idioma al que queremos que nos traduzca
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> translate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ini</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fin</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$buff</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$ini</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ini</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$fin</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://translate.google.com/translate_a/t?client=t&amp;text=&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;sl=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ini</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;tl=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fin</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000088;">$curl_handle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<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: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span> CURLOPT_USERAGENT<span style="color: #339933;">,</span> <span style="color: #0000ff;">'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: application/x-www-form-urlencoded;charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</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: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
 <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</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;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</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: #009900;">&#125;</span>
&nbsp;
 <span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">utf8_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buffer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</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>
&nbsp;
<span style="color: #666666; font-style: italic;">//[ Ejemplo ]//</span>
<span style="color: #b1b100;">echo</span> translate<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Mi perro se llama Pedro&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;es&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;en&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Seguro que les servira a mas de uno saludos!!!:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/05/09/traduccion-automatica-con-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enviar post a Twitter con PHP</title>
		<link>http://www.mixinformatico.com/2010/05/09/enviar-post-a-twitter-con-php/</link>
		<comments>http://www.mixinformatico.com/2010/05/09/enviar-post-a-twitter-con-php/#comments</comments>
		<pubDate>Sun, 09 May 2010 16:23:11 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Enviar post a Twitter con PHP]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[Twitter con PHP]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9239</guid>
		<description><![CDATA[Esta es una funcion muy util para los webmaster twitteros ya que pueden manda un post desde su web directamente a su twitter indicando su usuario contraseña y su mensaje, la interfaz de como lo hagan ya depende de ustedes saludos y espero que les sirva esta funcion: 1 2 3 4 5 6 7 [...]]]></description>
			<content:encoded><![CDATA[<p>Esta es una funcion muy util para los webmaster twitteros ya que pueden manda un post desde su web directamente a su twitter indicando su usuario contraseña y su mensaje, la interfaz de como lo hagan ya depende de ustedes saludos y espero que les sirva esta funcion:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> tweet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$context</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">'method'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'POST'</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'header'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authorization: Basic <span style="color: #009933; font-weight: bold;">%s</span><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: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
 <span style="color: #0000ff;">&quot;Content-type: application/x-www-form-urlencoded<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;">'content'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">http_build_query</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'status'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">'timeout'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$ret</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://twitter.com/statuses/update.xml'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$context</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">!==</span> <span style="color: #000088;">$ret</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/05/09/enviar-post-a-twitter-con-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generar Contraseña aleatoria con PHP</title>
		<link>http://www.mixinformatico.com/2010/05/09/generar-contrasena-aleatoria-con-php/</link>
		<comments>http://www.mixinformatico.com/2010/05/09/generar-contrasena-aleatoria-con-php/#comments</comments>
		<pubDate>Sun, 09 May 2010 16:14:29 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[Contraseña aleatoria en php]]></category>
		<category><![CDATA[Generar Contraseña aleatoria con PHP]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9236</guid>
		<description><![CDATA[Cuando damos de alta usuarios de forma automática a menudo necesitamos poner una contraseña por defecto. Este script PHP nos devuelve una contraseña aleatoria de la longitud en caracteres que le pasemos: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 function getRandomPWD&#40;$length = 10&#41;&#123; $password = &#34;&#34;; $possible [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando damos de alta usuarios de forma automática a menudo necesitamos  poner una <strong>contraseña </strong>por <strong>defecto</strong>. Este  script PHP nos devuelve una <strong>contraseña aleatoria</strong> de la  longitud en caracteres que le pasemos:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getRandomPWD<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$possible</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0123456789bcdfghjkmnpqrstvwxyz&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> 
&nbsp;
 <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$char</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$possible</span><span style="color: #339933;">,</span> <span style="color: #990000;">mt_rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$possible</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: #cc66cc;">1</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;">strstr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #339933;">,</span> <span style="color: #000088;">$char</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$password</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$char</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">
<h2>Contraseña aleatoria</h2>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/05/09/generar-contrasena-aleatoria-con-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como crear una Web Modular</title>
		<link>http://www.mixinformatico.com/2010/03/28/como-crear-una-web-modular/</link>
		<comments>http://www.mixinformatico.com/2010/03/28/como-crear-una-web-modular/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 02:16:18 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[Html]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[crear una web modular]]></category>
		<category><![CDATA[web modular]]></category>
		<category><![CDATA[web modular en html php css]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9100</guid>
		<description><![CDATA[Que tal users de mix informatico, antes que nada vamos a nesesitar algunos conocimientos previos de los lenguajes php , html y css, cabe mensionar que pueden lograr crear la web modular sin estos conocimientos pero les costara un poco mas de trabajo, bueno para comenzar vamos a crear un archivo php a el cual [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Que tal users de mix informatico, antes que nada vamos a nesesitar algunos conocimientos previos de los lenguajes php , html y css, cabe mensionar que pueden lograr crear la web modular sin estos conocimientos pero les costara un poco mas de trabajo, bueno para comenzar vamos a crear un archivo php a el cual nombraremos:</p>
<p>Contenido.php</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
 <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;seccion&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'noticias'</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;modulos/principal.php&quot;</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;">'linux'</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;modulos/linux.php&quot;</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;">'descargar'</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;modulos/descargar.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
 <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;modulos/principal.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><span id="more-9100"></span></p>
<p style="text-align: justify;">el metodo de seleccion switch () ya lohempos utilizado en otros lenguajes como java este funciona de la siguiente manera cuando switch recibe un parametro por ejemplo switch(&#8216;miwebprincipal&#8217;) se ira comparando en cada caso (case) aver si existe alguno que contenga ese nombre por ejemplo:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'miwebprincipal'</span>
<span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//en este caso entrara</span>
<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'miwebprincipal'</span><span style="color: #339933;">:</span>
<span style="color: #666666; font-style: italic;">//aqui entrara</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p style="text-align: justify;">el break; sirve para que no se siga comparando con los demas casos y hay termine de comparar y asi muestra lo que tenga ese caso. Ahora nesesitamos incluir ese Contenido.php a un index o alguna pagina principal entonces creamos:</p>
<p>Index.php</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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Ejemplo de Web Modular&lt;/title&gt;
&lt;style&gt;
body{
padding:0;
margin:0 auto;
background:url(imagenes/bck.jpg) repeat-x;
}
.principal{
padding:0;
margin:0 auto;
width:900px;
background:#cccccc;
border-right: 1px solid #000000;
border-left: 1px solid #000000;
}
.cuadros{
background:#ffffff; height:400px;
border-right: 1px solid #000000;
border-left: 1px solid #000000;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
.link{
height:20px;
}
A:link {
FONT-SIZE: 13px;
COLOR:#FF3300;
FONT-FAMILY:  arial, helvetica, verdana, sans-serif;
text-decoration: none;
}
A:visited {
FONT-SIZE: 13px;
COLOR:#FF3300;
FONT-FAMILY:  arial, helvetica, verdana, sans-serif;
TEXT-DECORATION: none;
}
A:active {
FONT-SIZE: 13px;
COLOR:#FF3300;
FONT-FAMILY:  arial, helvetica, verdana, sans-serif;
TEXT-DECORATION: none;
}
A:hover {
font-size: 13px;
color: #7ed9ff;
font-family:  arial, helvetica, verdana, sans-serif;
}
&nbsp;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;center&gt;
&lt;div align=&quot;center&quot;&gt;&lt;img width=&quot;900&quot; height=&quot;100&quot; src=&quot;imagenes/header.gif&quot; alt=&quot;Cabecera&quot; /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;table width=&quot;900&quot; border=&quot;0&quot; cellspacing=&quot;10&quot; cellpadding=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;250&quot;&gt;
&lt;div&gt;
&lt;div&gt;&lt;a href=&quot;index.php?seccion=principal&quot;&gt;&lt;B&gt;Principal&lt;/B&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href=&quot;index.php?seccion=linux&quot;&gt;&lt;B&gt;Apache en Linux&lt;/B&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href=&quot;index.php?seccion=descargar&quot;&gt;&lt;B&gt;Descargar Template&lt;/B&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;div&gt;
&lt;div style=&quot;border: 0px solid #D1D1D1; OVERFLOW-y: scroll; OVERFLOW-x: hidden; HEIGHT: 400px&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;contenido.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;table width=&quot;900&quot; border=&quot;2&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot;&gt;
&lt;tr&gt;
&lt;td align=&quot;center&quot;&gt;Copyright 2010 www.mixinformatico.com&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Bueno ya saben la inclusion del contenido la haremos en la parte qeu sutedes gusten del index esto ya sera para lo estetico y lo hacemos de esta forma:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;contenido.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>los links para que nuestro contenido sea llamado lo se deven crear asi:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;index.php?seccion=principal&quot;</span><span style="color: #339933;">&gt;&lt;</span>B<span style="color: #339933;">&gt;</span>Principal<span style="color: #339933;">&lt;/</span>B<span style="color: #339933;">&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>este es el Css que hice para mi ejemplo pero ustedes pueden crearlo o modificarlo a su gusto:</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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>style<span style="color: #339933;">&gt;</span>
body<span style="color: #009900;">&#123;</span>
padding<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
margin<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> auto<span style="color: #339933;">;</span>
background<span style="color: #339933;">:</span>url<span style="color: #009900;">&#40;</span>imagenes<span style="color: #339933;">/</span>bck<span style="color: #339933;">.</span>jpg<span style="color: #009900;">&#41;</span> repeat<span style="color: #339933;">-</span>x<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>principal<span style="color: #009900;">&#123;</span>
padding<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
margin<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> auto<span style="color: #339933;">;</span>
width<span style="color: #339933;">:</span>900px<span style="color: #339933;">;</span>
background<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#cccccc;
</span>border<span style="color: #339933;">-</span>right<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span>border<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span><span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span>cuadros<span style="color: #009900;">&#123;</span>
background<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#ffffff; height:400px;
</span>border<span style="color: #339933;">-</span>right<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span>border<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span>border<span style="color: #339933;">-</span>top<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span>border<span style="color: #339933;">-</span>bottom<span style="color: #339933;">:</span> 1px solid <span style="color: #666666; font-style: italic;">#000000;
</span><span style="color: #009900;">&#125;</span>
<span style="color: #339933;">.</span><span style="color: #990000;">link</span><span style="color: #009900;">&#123;</span>
height<span style="color: #339933;">:</span>20px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
A<span style="color: #339933;">:</span><span style="color: #990000;">link</span> <span style="color: #009900;">&#123;</span>
FONT<span style="color: #339933;">-</span>SIZE<span style="color: #339933;">:</span> 13px<span style="color: #339933;">;</span>
COLOR<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#FF3300;
</span>FONT<span style="color: #339933;">-</span>FAMILY<span style="color: #339933;">:</span>  arial<span style="color: #339933;">,</span> helvetica<span style="color: #339933;">,</span> verdana<span style="color: #339933;">,</span> sans<span style="color: #339933;">-</span>serif<span style="color: #339933;">;</span>
text<span style="color: #339933;">-</span>decoration<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
A<span style="color: #339933;">:</span>visited <span style="color: #009900;">&#123;</span>
FONT<span style="color: #339933;">-</span>SIZE<span style="color: #339933;">:</span> 13px<span style="color: #339933;">;</span>
COLOR<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#FF3300;
</span>FONT<span style="color: #339933;">-</span>FAMILY<span style="color: #339933;">:</span>  arial<span style="color: #339933;">,</span> helvetica<span style="color: #339933;">,</span> verdana<span style="color: #339933;">,</span> sans<span style="color: #339933;">-</span>serif<span style="color: #339933;">;</span>
TEXT<span style="color: #339933;">-</span>DECORATION<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
A<span style="color: #339933;">:</span>active <span style="color: #009900;">&#123;</span>
FONT<span style="color: #339933;">-</span>SIZE<span style="color: #339933;">:</span> 13px<span style="color: #339933;">;</span>
COLOR<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#FF3300;
</span>FONT<span style="color: #339933;">-</span>FAMILY<span style="color: #339933;">:</span>  arial<span style="color: #339933;">,</span> helvetica<span style="color: #339933;">,</span> verdana<span style="color: #339933;">,</span> sans<span style="color: #339933;">-</span>serif<span style="color: #339933;">;</span>
TEXT<span style="color: #339933;">-</span>DECORATION<span style="color: #339933;">:</span> none<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
A<span style="color: #339933;">:</span>hover <span style="color: #009900;">&#123;</span>
font<span style="color: #339933;">-</span>size<span style="color: #339933;">:</span> 13px<span style="color: #339933;">;</span>
color<span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">#7ed9ff;
</span>font<span style="color: #339933;">-</span>family<span style="color: #339933;">:</span>  arial<span style="color: #339933;">,</span> helvetica<span style="color: #339933;">,</span> verdana<span style="color: #339933;">,</span> sans<span style="color: #339933;">-</span>serif<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Aqui les dejo una captura:</p>
<p><a href="http://www.mixinformatico.com/wp-content/uploads/2010/03/ejemplo.gif" title="ejemplo" rel="lightbox[9100]"><img class="alignnone size-medium wp-image-9101" title="ejemplo" src="http://www.mixinformatico.com/wp-content/uploads/2010/03/ejemplo-300x142.gif" alt="" width="300" height="142" /></a></p>
<p>Bueno aqui les dejo el demo:<br />
<a href="http://webmodular.mixinformatico.com/">http://webmodular.mixinformatico.com/</a><br />
Y aqui la descarga:<br />
<a href="http://webmodular.mixinformatico.com/descarga.zip">descargar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/28/como-crear-una-web-modular/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Contador de Visitas en php y mysql</title>
		<link>http://www.mixinformatico.com/2010/03/27/contador-de-visitas-en-php-y-mysql/</link>
		<comments>http://www.mixinformatico.com/2010/03/27/contador-de-visitas-en-php-y-mysql/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 23:30:27 +0000</pubDate>
		<dc:creator>dementexmaster</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[contador]]></category>
		<category><![CDATA[contador de visitas]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9097</guid>
		<description><![CDATA[Que tal amigos de Mix informatico Aqui les traigo un contador el cual su funcion es: En una tabla de nuestra BD se guardan, La fecha y Hora de la visita y la direccion IP de la Maquina. Cada vez que se accede en la pagina el Script se activa y busca en la BD, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Que tal amigos de Mix informatico Aqui les traigo un contador el cual su funcion es:</p>
<p style="text-align: justify;">En una tabla de nuestra BD se guardan, La fecha y Hora de la visita y la direccion IP de la Maquina. Cada vez que se accede en la pagina el Script se activa y busca en la BD, si encuentra la misma IP en un ragdo de tiempo dado, pasa por alto la visita, pero si la IP no se encuentra o supera dicho rango de tiempo (1minuto, 1 hora, 1 dia, etc.) depende del programador, almacena los datos.</p>
<p style="text-align: justify;">Por ultimo, corremos una linea que selecciona TODO el contenido de la tabla y nos muestra cuantos registros hay, que seria lo mismo que el numero real de visitas de la pagina web.</p>
<p style="text-align: justify;">En otras palabras, si entramos en la Web marcamos una visita, pero si damos Actualizar (F5), cerramos y volvemos a cargar, no acumularemos mas visitas&#8230;</p>
<p style="text-align: justify;"><strong><span style="color: #0000ff;">contador.sql</span></strong></p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td 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;">`contador`</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;">`ip`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">15</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>   
 <span style="color: #008000;">`hora`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">8</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</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;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">20</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>   
 <span style="color: #008000;">`horau`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>   
 <span style="color: #008000;">`diau`</span> <span style="color: #000099;">char</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">3</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>   
 <span style="color: #008000;">`aniou`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">default</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</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;">TYPE</span><span style="color: #CC0099;">=</span>MyISAM <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></td></tr></table></div>

<p><span id="more-9097"></span></p>
<p style="text-align: justify;"><strong><span style="color: #0000ff;">config.php</span></strong></p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>   
 <span style="color: #000088;">$bd_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Nombre del servidor de BD&quot;</span><span style="color: #339933;">;</span>   
 <span style="color: #000088;">$bd_usuario</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Nombre de usuario de BD&quot;</span><span style="color: #339933;">;</span>   
 <span style="color: #000088;">$bd_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Password de BD&quot;</span><span style="color: #339933;">;</span>   
 <span style="color: #000088;">$bd_base</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Nombre de BD&quot;</span><span style="color: #339933;">;</span>   
 <span style="color: #000088;">$con</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bd_host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bd_usuario</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bd_password</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;">$bd_base</span><span style="color: #339933;">,</span> <span style="color: #000088;">$con</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
 <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p style="text-align: justify;"><strong><span style="color: #0000ff;">contadordeuser.php</span></strong></p>
<p style="text-align: justify;">

<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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//se requiere el archivo para validar los datos de usuario de bdd para conectar</span>
<span style="color: #000088;">$ip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$REMOTE_ADDR</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fecha</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;j \d\e\l n \d\e Y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hora</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;h:i:s&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$horau</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;h&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$diau</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;z&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$aniou</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//se asignan la variables</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT aniou, diau, horau, ip &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;FROM contador WHERE aniou LIKE '<span style="color: #006699; font-weight: bold;">$aniou</span>' AND diau LIKE '<span style="color: #006699; font-weight: bold;">$diau</span>' AND horau LIKE '<span style="color: #006699; font-weight: bold;">$horau</span>' AND ip LIKE '<span style="color: #006699; font-weight: bold;">$ip</span>' &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$es</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: #339933;">,</span> <span style="color: #000088;">$con</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 leer base de datos: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//se buscan los registros que coincidan con la hora,dia,año e ip  </span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$es</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//no se cuenta la visita</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;INSERT INTO contador (id, ip, fecha, hora, horau, diau, aniou) &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;VALUES ('','<span style="color: #006699; font-weight: bold;">$ip</span>','<span style="color: #006699; font-weight: bold;">$fecha</span>','<span style="color: #006699; font-weight: bold;">$hora</span>','<span style="color: #006699; font-weight: bold;">$horau</span>','<span style="color: #006699; font-weight: bold;">$diau</span>','<span style="color: #006699; font-weight: bold;">$aniou</span>')&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$es</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: #339933;">,</span> <span style="color: #000088;">$con</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 grabar un mensaje: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//creamos el condicionamiendo para logearlo o no.</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT * &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;FROM contador WHERE id &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$es</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: #339933;">,</span> <span style="color: #000088;">$con</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 leer base de datos: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$visitas</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$es</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$men</span><span style="color: #339933;">=</span><span style="color: #000088;">$men</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;table width='9<span style="color: #009933; font-weight: bold;">%' b</span>order='1' height='25' bgcolor='#333333'&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$men</span><span style="color: #339933;">=</span><span style="color: #000088;">$men</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$men</span><span style="color: #339933;">=</span><span style="color: #000088;">$men</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;td&gt;&lt;font color=#FFFFFF&gt;Visitas:<span style="color: #006699; font-weight: bold;">$visitas</span>&lt;/font&gt;&lt;/td&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$men</span><span style="color: #339933;">=</span><span style="color: #000088;">$men</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$men</span><span style="color: #339933;">=</span><span style="color: #000088;">$men</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/table&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p style="text-align: justify;"><strong><span style="color: #0000ff;">index.php</span></strong></p>
<p style="text-align: justify;">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contadordeuser.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$men</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/27/contador-de-visitas-en-php-y-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uso de Variables en PHP</title>
		<link>http://www.mixinformatico.com/2010/03/27/uso-de-variables-en-php/</link>
		<comments>http://www.mixinformatico.com/2010/03/27/uso-de-variables-en-php/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 03:02:26 +0000</pubDate>
		<dc:creator>jean1904</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9069</guid>
		<description><![CDATA[Bueno hoy les voy a enseñar a declarar variables y a mostrarlas en la pagina o en un input, bueno las variables se declaran de la siguiente manera 1 $variable = &#34;loquequieras&#34;; como pueden ver en donde dice loquequieras va lo que quieras que se muestre al mostrarla en la web, y $variable es la [...]]]></description>
			<content:encoded><![CDATA[<p>Bueno hoy les voy a enseñar a declarar variables y a mostrarlas en la pagina o en un input, bueno las variables se declaran de la siguiente manera</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$variable</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;loquequieras&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>como pueden ver en donde dice loquequieras va lo que quieras que se muestre al mostrarla en la web, y $variable es la variable que halaras</p>
<p>Ahora les enseñare a halar una variable, que se hace de la siguiente manera:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$variable</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Lo siguiente es mostrar una variable desde php a html, Para eso asignamos la variable, y luego la mostramos, ejemplo en un campo de texto:</p>
<p><span style="font-family: Arial"><span style="line-height: normal">&lt;input name=&#8221;varaible&#8221; type=&#8221;text&#8221; value=&#8221;&lt;?=$variable; ?&gt;&#8221; /&gt;</span></span></p>
<p>alli cuando abramos la web, automaticamente se mostrara un campo de texto con lo que haigas puesto en la variable.</p>
<p>y por ultimo les enseñare a usar 2 variables automaticas, que son:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'variable'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'variable'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Primero empezemos con GET y su explicacion, esta varaible se usa para extraer codigos puestos en la url, ejemplo</p>
<p>http://web.com/archivo.php?variable=hola</p>
<p>si luego hacemos</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'variable'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>alli estamos mostrando hola, ya que es lo que se encuentra al lado de variable=</p>
<p>Y por ultimo les enseñare POST, este se usa para llamar un input o algun elemento, con el nombre en el cual pondramos en ['variable']</p>
<p>supongamos queremos halar lo que dice en un input ejemplo</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;input name=&quot;variable&quot; type=&quot;text&quot; /&gt;</pre></td></tr></table></div>

<p>y en la pagina que lleve al form salga echo $_POST['variable'];</p>
<p>si escribimos en el campo de texto hola, cuando le demos al boton nos dira hola&#8230;</p>
<p>Esto fue Todo por hoy.</p>
<p>At.. Jean1904</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/27/uso-de-variables-en-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jalar Datos de Registros MYSQL y mostrarlos en la web, Desde PHP</title>
		<link>http://www.mixinformatico.com/2010/03/26/jalar-datos-de-registros-mysql-y-mostrarlos-en-la-web-desde-php/</link>
		<comments>http://www.mixinformatico.com/2010/03/26/jalar-datos-de-registros-mysql-y-mostrarlos-en-la-web-desde-php/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 06:47:27 +0000</pubDate>
		<dc:creator>jean1904</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9042</guid>
		<description><![CDATA[Jalar Datos de Registro, y mostrarlo en la web Bien para hacer esto debemos de hacer coneccion a mysql y tambien necesitamos tener registros en mysql, tambien debemos tomar en cuenta, de que si no se siguen los pasos tal cual, podemos ser vulnerable a injecciones SQL, comenzemos. Primero debemos tener claro que podemos sacar [...]]]></description>
			<content:encoded><![CDATA[<p>Jalar Datos de Registro, y mostrarlo en la web</p>
<p>Bien para hacer esto debemos de hacer coneccion a mysql y tambien necesitamos tener registros en mysql, tambien debemos tomar en cuenta, de que si no se siguen los pasos tal cual, podemos ser vulnerable a injecciones SQL, comenzemos.</p>
<p>Primero debemos tener claro que podemos sacar datos fijos, o tambien sacar datos dependiendo de la web ejemplo blabla.com/noticia.php?id=1, alli lo que haria seria sacar la noticia que tenga como registro &#8220;id&#8221; y tenga numero &#8220;1&#8243;, comenzemos primero con un valor fijo y luego con la url&#8230;</p>
<p>Valor Fijo:<br />
Debemos primero es asignar una variable con el valor de una consulta en este caso: &#8220;result&#8221;, bien ponemos:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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: #0000ff;">&quot;SELECT registro1 FROM tabla WHERE registro2 = 'valor'&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</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></td></tr></table></div>

<p>Bien seguro leyendo bien el codigo, se preguntaran, por que tienen 2 veces registro?, bien aqui se los explico:</p>
<p>El registro1, viene siendo el valor del registro que vamos a sacar, ejemplo username, vendria saliendo &#8220;jean1904&#8243;, luego viene tabla, en tabla vendria siendo la tabla el cual vamos a entrar, ejemplo usuarios, el registro2 vendria siendo el registro a buscar ejemplo, si quieremos sacar el registro1 &#8220;username&#8221;, y ese username tiene el valor id en 1, debemos poner registro2 lo cambiamos a id, y en valor ponemos &#8217;1&#8242;, recuerde que siempre en valor lleva el &#8216;  &#8216;.</p>
<p>Ahora debemos hacer que nos muestre los datos en la web, esto seria asi:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td 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_row</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: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$row[0]</span>&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>el $row[0] jalaria el registro1, si queremos hacer que jale varios registro, nada mas cambiamos en la variable $result, en donde dice registro1, podemos poner: registro1,registro2,registro3<br />
toncs se va enumerando de 0 asia arriba, toncs seria echo &#8220;$row[0]&#8221; echo &#8220;$row[1]&#8221; echo &#8220;$row[2]&#8221;</p>
<p>Valor en url:<br />
Bueno Aqui debemos tener cuidado, ya que mediante este metodo Nos pueden hacer Sql Injection&#8230;<br />
Debemos hacer casi lo mismo que arriba, pero en este caso vamos a cambiar el &#8216;valor&#8217; por el id encontrado en la url, comenzemos:</p>
<p>Primero asignamos el numero puesto en la url a una variable en este caso: &#8220;user&#8221;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Luego vamos a hacer que si alguien que quiere hacer sql injection pone select, algo que es obligatorio en sql injection, remplazamos select por 1, osea que no sera vulnerable:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$usi</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;select&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>aqui lo que hace es remplasar select por 1, a la variable $user: ahora debemos hacer la consulta en variable que vendria siendo:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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: #0000ff;">&quot;SELECT registro1 FROM tabla WHERE id = &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$usi</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</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></td></tr></table></div>

<p>Ahora debemos hacer que nos muestre los datos en la web, esto seria asi:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td 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_row</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: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$row[0]</span>&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>el $row[0] jalaria el registro1, si queremos hacer que jale varios registro, nada mas cambiamos en la variable $result, en donde dice registro1, podemos poner: registro1,registro2,registro3<br />
toncs se va enumerando de 0 asia arriba, toncs seria echo &#8220;$row[0]&#8221; echo &#8220;$row[1]&#8221; echo &#8220;$row[2]&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/26/jalar-datos-de-registros-mysql-y-mostrarlos-en-la-web-desde-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear Tablas Mysql en PHP</title>
		<link>http://www.mixinformatico.com/2010/03/26/crear-tablas-mysql-en-php/</link>
		<comments>http://www.mixinformatico.com/2010/03/26/crear-tablas-mysql-en-php/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 06:43:12 +0000</pubDate>
		<dc:creator>jean1904</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9039</guid>
		<description><![CDATA[Crear tablas en base de datos desde php: Bueno lo primero que debemos hacer es hacer coneccion a mysql, que ya puse un post acerca de eso Bueno las tablas son las variables que guardan los datos, osea si tenemos una tabla con el nombre username, y vendria siendo el nombre de usuario en este [...]]]></description>
			<content:encoded><![CDATA[<p>Crear tablas en base de datos desde php:</p>
<p>Bueno lo primero que debemos hacer es hacer coneccion a mysql, que ya puse un post acerca de eso</p>
<p>Bueno las tablas son las variables que guardan los datos, osea si tenemos una tabla con el nombre username, y vendria siendo el nombre de usuario en este caso jean1904, lo que haria al jalar la tabla username, saldria jean1904, recuerden que las tablas pueden guardar muchos registros, como jean1904, jeann, 3ldiosfenix</p>
<p>Para Crear las tablas primero debemos asignar una variable, con el valor de una consulta, Bueno en este caso la variable seria query, toncs tendriamos que poner.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'CREATE TABLE usuarios(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
usuario VARCHAR(30) NOT NULL,
contraseña VARCHAR(20) NOT NULL,
email VARCHAR(30) NOT NULL)'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Bueno Donde dice CREATE TABLE usuarios, usuarios viene siendo el nombre de la tabla, y donde sale:<br />
id INT NOT NULL AUTO_INCREMENT,<br />
PRIMARY KEY(id), vendria siendo el registro id, que normalmente se usa como referencia para jalar datos, y tambien se auto incrementa en numeros, ejemplo 1,2,3,4,5,6,7,8,9,10, y asi sin limites&#8230;</p>
<p>Donde dice:<br />
usuario VARCHAR(30) NOT NULL Usuario vendria siendo el primer registro, y VARCHAR(30) vendria siendo la capacidad de digitos que puedes introducir, supongamos que solo necesite 1 digito, introducimos VARCHAR(1), cambiando el (30) por (1), y asi igual con los demas como contraseña y email&#8230;</p>
<p>y luego hacer que algun otra variable jalara la variable query y genere la consulta en mysql</p>
<p>osea:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;!Tabla creada!1&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>en caso de que la tabla se cree les va a salir !Tabla Creada!1, y si no se crea, deberia de quedar en blanco, o lanzar un error mysql.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/26/crear-tablas-mysql-en-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacer Conexion a Mysql Desde Php</title>
		<link>http://www.mixinformatico.com/2010/03/26/hacer-conexion-a-mysql-desde-php/</link>
		<comments>http://www.mixinformatico.com/2010/03/26/hacer-conexion-a-mysql-desde-php/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 06:39:37 +0000</pubDate>
		<dc:creator>jean1904</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.mixinformatico.com/?p=9036</guid>
		<description><![CDATA[Hacer Coneccion a MySql: Bueno para hacer coneccion a mysql, lo primero que haremos sera asignar variables con los datos del host&#8230; 1 2 3 4 $dbhost='localhost'; // el host del mysql, normalmente es localhost $dbusername='user'; // el usuario del mysql $dbuserpass='pass'; // contraseña del usuario mysql $dbname='db'; // Base de datos a entrar Luego [...]]]></description>
			<content:encoded><![CDATA[<p>Hacer Coneccion a MySql:</p>
<p>Bueno para hacer coneccion a mysql, lo primero que haremos sera asignar variables con los datos del host&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dbhost</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>                    <span style="color: #666666; font-style: italic;">// el host del mysql, normalmente es localhost</span>
<span style="color: #000088;">$dbusername</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'user'</span><span style="color: #339933;">;</span>                   <span style="color: #666666; font-style: italic;">// el usuario del mysql</span>
<span style="color: #000088;">$dbuserpass</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'pass'</span><span style="color: #339933;">;</span>                  <span style="color: #666666; font-style: italic;">// contraseña del usuario mysql</span>
<span style="color: #000088;">$dbname</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'db'</span><span style="color: #339933;">;</span>                         <span style="color: #666666; font-style: italic;">// Base de datos a entrar</span></pre></td></tr></table></div>

<p>Luego debemos hacer la coneccion haciendo referencia las variables ya mostradas</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">$dbusername</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuserpass</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;">$dbname</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'La Base de datos no ha podido ser seleccionada'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Bien, lo que hace la primera linea seria hacer coneccion al mysql<br />
y la segunda linea, haria coneccion a la base de datos, en caso de que la base de datos no exista, o los datos introducidos sean incorrectos saldria La Base de datos no ha podido ser seleccionada..</p>
<p>El codigo nos debio aver quedado asi:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dbhost</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dbusername</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'user'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dbuserpass</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'pass'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dbname</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'db'</span><span style="color: #339933;">;</span>
&nbsp;
<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;">$dbusername</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuserpass</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;">$dbname</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'La Base de datos no ha podido ser seleccionada'</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.mixinformatico.com/2010/03/26/hacer-conexion-a-mysql-desde-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 5.103 seconds -->

