<?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>PHP, MYSQL, CSS, LINUX TUTORIALS</title>
	<atom:link href="http://www.mlabs.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mlabs.info</link>
	<description></description>
	<lastBuildDate>Fri, 23 Mar 2012 12:32:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Add error image when a image is not found</title>
		<link>http://www.mlabs.info/add-error-image/</link>
		<comments>http://www.mlabs.info/add-error-image/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 12:18:35 +0000</pubDate>
		<dc:creator>Samuel Marian</dc:creator>
				<category><![CDATA[jQuery Tutorials]]></category>
		<category><![CDATA[404 error]]></category>
		<category><![CDATA[image not found]]></category>
		<category><![CDATA[jquery tutorial]]></category>

		<guid isPermaLink="false">http://www.mlabs.info/?p=1077</guid>
		<description><![CDATA[When creating a website, a priority is to make your website load faster. That&#8217;s good! But what are you doing if your website is embeding &#8230; <a class="more-btn" href="http://www.mlabs.info/add-error-image/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>When creating a website, a priority is to make your website load faster. <b>That&#8217;s good!</b><br />
But what are you doing if your website is embeding some images who doesn&#8217;t exist?</p>
<p><b>Example:</b></p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1077code3'); return false;">View Code</a> HTML</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p10773">
<td class="code" id="p1077code3">
<pre class="html" style="font-family:monospace;">&lt;img src=&quot;http://example.com/my-image.jpg&quot;&gt;</pre>
</td>
</tr>
</table>
</div>
<p>If the image <em>(my-image.jpg in our example)</em> doesn&#8217;t exist, your website will get loaded more slowly but if you user the .error event from jQuery you can solve this problem easily.</p>
<p>Example:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1077code4'); return false;">View Code</a> JAVASCRIPT</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p10774">
<td class="code" id="p1077code4">
<pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">error</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'src'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'http://example.com/image-not-found.jpg);
	});
});</span></pre>
</td>
</tr>
</table>
</div>
<p>So this script changes the image source to the error image <em>(image-not-found.jpg) in our example)</em> and your should not have any problem visiting your website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlabs.info/add-error-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Move Up and Move Down button using jQuery</title>
		<link>http://www.mlabs.info/create-move-move-button-jquery/</link>
		<comments>http://www.mlabs.info/create-move-move-button-jquery/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 11:44:22 +0000</pubDate>
		<dc:creator>Samuel Marian</dc:creator>
				<category><![CDATA[jQuery Tutorials]]></category>
		<category><![CDATA[HTML Tutorials]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.mlabs.info/?p=1044</guid>
		<description><![CDATA[I&#8217;m sorry i haven&#8217;t posted new tutorials for a long time. And very soon i&#8217;ll update the wordpress plugin Maribol IMDB. So what i would &#8230; <a class="more-btn" href="http://www.mlabs.info/create-move-move-button-jquery/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sorry i haven&#8217;t posted new tutorials for a long time.<br />
And very soon i&#8217;ll update the <a href="http://www.mlabs.info/maribol-imdb/" target="_blank">wordpress plugin Maribol IMDB</a>.</p>
<p>So what i would like to teach you today is how to move an element using the powerfull jQuery.</p>
<p>Let&#8217;s asume that you want to order the order for some text inputs</p>
<p>HTML structure:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1044code7'); return false;">View Code</a> HTML</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p10447">
<td class="code" id="p1044code7">
<pre class="html" style="font-family:monospace;">&lt;div&gt;
    &lt;div&gt;
        &lt;input type=&quot;text&quot; name=&quot;values[]&quot; value=&quot;value 1&quot;&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveUp&quot;&gt;&amp;uarr;&lt;/a&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveDown&quot;&gt;&amp;darr;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div&gt;
        &lt;input type=&quot;text&quot; name=&quot;values[]&quot; value=&quot;value 2&quot;&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveUp&quot;&gt;&amp;uarr;&lt;/a&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveDown&quot;&gt;&amp;darr;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div&gt;
        &lt;input type=&quot;text&quot; name=&quot;values[]&quot; value=&quot;value 3&quot;&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveUp&quot;&gt;&amp;uarr;&lt;/a&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveDown&quot;&gt;&amp;darr;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div&gt;
        &lt;input type=&quot;text&quot; name=&quot;values[]&quot; value=&quot;value 4&quot;&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveUp&quot;&gt;&amp;uarr;&lt;/a&gt;
        &lt;a href=&quot;javascript:;&quot; class=&quot;moveDown&quot;&gt;&amp;darr;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
</td>
</tr>
</table>
</div>
<p>Javascript:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1044code8'); return false;">View Code</a> JAVASCRIPT</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p10448">
<td class="code" id="p1044code8">
<pre class="javascript" style="font-family:monospace;">    $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.moveUp'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> current <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            current.<span style="color: #660066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">before</span><span style="color: #009900;">&#40;</span>current<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>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.moveDown'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> current <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            current.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">after</span><span style="color: #009900;">&#40;</span>current<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>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</td>
</tr>
</table>
</div>
<p><a href="http://www.mlabs.info/wp-content/uploads/2011/11/demo.html" target="_blank">View demo here</a></p>
<p>If you have any question please leave them in the comments section.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlabs.info/create-move-move-button-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using AJAX and PHP together</title>
		<link>http://www.mlabs.info/ajax-php/</link>
		<comments>http://www.mlabs.info/ajax-php/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 18:21:58 +0000</pubDate>
		<dc:creator>Samuel Marian</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://www.mlabs.info/?p=922</guid>
		<description><![CDATA[In this tutorial i&#8217;ll show you how to use PHP and AJAX together and get the results that you need. Here&#8217;s an example of a &#8230; <a class="more-btn" href="http://www.mlabs.info/ajax-php/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial i&#8217;ll show you how to use PHP and AJAX together and get the results that you need.</p>
<p><b>Here&#8217;s an example of a function that executes a ajax request</b></p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p922code14'); return false;">View Code</a> JAVASCRIPT</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p92214">
<td class="code" id="p922code14">
<pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> execAjax<span style="color: #009900;">&#40;</span>type<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
      url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'ajax.php?type='</span><span style="color: #339933;">+</span>type<span style="color: #339933;">,</span>
      dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">'json'</span><span style="color: #339933;">,</span>
      success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> data <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003366; font-weight: bold;">var</span> items <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
         $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            items.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;li id=&quot;'</span> <span style="color: #339933;">+</span> key <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;'</span> <span style="color: #339933;">+</span> val <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/li&gt;'</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: #009900;">&#40;</span><span style="color: #3366CC;">'#results'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;ul/&gt;'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #3366CC;">'class'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'results-list'</span><span style="color: #339933;">,</span>
               html<span style="color: #339933;">:</span> items.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</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;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre>
</td>
</tr>
</table>
</div>
<p>This function should add a list with all the items resulted from the request.</p>
<p><b>Example of use:</b></p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p922code15'); return false;">View Code</a> HTML</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p92215">
<td class="code" id="p922code15">
<pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascript:;&quot; onclick=&quot;execAjax('fruits')&quot;&gt;fruits&lt;/a&gt;
&lt;a href=&quot;javascript:;&quot; onclick=&quot;execAjax('vegetables')&quot;&gt;vegetables&lt;/a&gt;
&lt;a href=&quot;javascript:;&quot; onclick=&quot;execAjax('furniture')&quot;&gt;furniture&lt;/a&gt;
&nbsp;
&lt;div id=&quot;results&quot;&gt;&lt;/div&gt;</pre>
</td>
</tr>
</table>
</div>
<p>And the ajax.php return an array encoded in json.</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p922code16'); return false;">View Code</a> PHP</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p92216">
<td class="code" id="p922code16">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
   <span style="color: #0000ff;">'fruits'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'apple'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'bannana'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'orange'</span>
   <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
   <span style="color: #0000ff;">'vegetables'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'potato'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'carrot'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'onion'</span>
   <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
   <span style="color: #0000ff;">'furniture'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'chair'</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'desk'</span>
   <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$results</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</td>
</tr>
</table>
</div>
<p>If we&#8217;ve clicked on the &#8220;fruits&#8221; link, will get a result like:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p922code17'); return false;">View Code</a> JSON</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p92217">
<td class="code" id="p922code17">
<pre class="json" style="font-family:monospace;">[&quot;apple&quot;,&quot;bannana&quot;,&quot;orange&quot;]</pre>
</td>
</tr>
</table>
</div>
<p>This encoded array will be transformed in list with the &#8220;each&#8221; function from jquery and the result that you should see is:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p922code18'); return false;">View Code</a> HTML</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p92218">
<td class="code" id="p922code18">
<pre class="html" style="font-family:monospace;">&lt;div id=&quot;results&quot;&gt;
   &lt;ul class=&quot;results-list&quot;&gt;
      &lt;li id=&quot;0&quot;&gt;apple&lt;/li&gt;
      &lt;li id=&quot;1&quot;&gt;bannana&lt;/li&gt;
      &lt;li id=&quot;2&quot;&gt;orange&lt;/li&gt;
   &lt;/ul&gt;
&lt;/div&gt;</pre>
</td>
</tr>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mlabs.info/ajax-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security Tutorial #2: Are you protected against sql injections?</title>
		<link>http://www.mlabs.info/security-tutorial-2-protected-sql-injections/</link>
		<comments>http://www.mlabs.info/security-tutorial-2-protected-sql-injections/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 12:34:42 +0000</pubDate>
		<dc:creator>Samuel Marian</dc:creator>
				<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[anti sql injection]]></category>
		<category><![CDATA[mysql_real_escape_string]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[stripslashes]]></category>

		<guid isPermaLink="false">http://www.mlabs.info/?p=965</guid>
		<description><![CDATA[There are alot of websites that are vulnerable to sql injections. In this tutorial i&#8217;ll give you some examples with methods to protect you website. &#8230; <a class="more-btn" href="http://www.mlabs.info/security-tutorial-2-protected-sql-injections/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mlabs.info/wp-content/uploads/2011/07/Security-Centre.png"><img src="http://www.mlabs.info/wp-content/uploads/2011/07/Security-Centre.png" alt="" title="Security Centre" width="128" height="128" class="alignleft size-full wp-image-957" /></a>There are alot of websites that are vulnerable to sql injections.<br />
In this tutorial i&#8217;ll give you some examples with methods to protect you website.</p>
<div style="clear:both;"></div>
<p>&nbsp;</p>
<p><strong>Make your id from url <em>(int) </em></strong></p>
<p>Let&#8217;s assume that you get the id like this:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p965code23'); return false;">View Code</a> PHP</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p96523">
<td class="code" id="p965code23">
<pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$id</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>Well with this, your site may be vulnerable.</p>
<p>But if you use like this it will never be vulerable from this variable:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p965code24'); return false;">View Code</a> PHP</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p96524">
<td class="code" id="p965code24">
<pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</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>Basically this will make your id an id, i mean the value returned is always numeric.</p>
<p>&nbsp;</p>
<p><strong>Use the <em>mysql_real_escape_string</em> function</strong><br />
This function may help you alot!</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p965code25'); return false;">View Code</a> PHP</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p96525">
<td class="code" id="p965code25">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$city</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'city'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT firstname, lastname FROM people WHERE city=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$city</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</td>
</tr>
</table>
</div>
<p><strong>Note:</strong> if <em>magic_quotes_gpc</em> is enabled you should use:</p>
<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p965code26'); return false;">View Code</a> PHP</span>
<div class="codebox_clear"></div>
</div>
<div class="wp_codebox">
<table>
<tr id="p96526">
<td class="code" id="p965code26">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$city</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'city'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT firstname, lastname FROM people WHERE city=&quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$city</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</td>
</tr>
</table>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mlabs.info/security-tutorial-2-protected-sql-injections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maribol Personal &#8211; WordPress Theme</title>
		<link>http://www.mlabs.info/maribol-personal-wordpress-theme/</link>
		<comments>http://www.mlabs.info/maribol-personal-wordpress-theme/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 22:16:09 +0000</pubDate>
		<dc:creator>Samuel Marian</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[free wordpress theme]]></category>

		<guid isPermaLink="false">http://www.mlabs.info/?p=969</guid>
		<description><![CDATA[Maribol Personal is a free wordpress theme with a very simple design but it looks pretty. Demo: here Download: here]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mlabs.info/wp-content/uploads/2011/07/screenshot.png"><img class="alignleft size-full wp-image-971" title="screenshot" src="http://www.mlabs.info/wp-content/uploads/2011/07/screenshot.png" alt="" width="300" height="225" /></a>Maribol Personal is a <strong>free wordpress theme</strong> with a very simple design but it looks pretty.</p>
<p>Demo: <a target="_blank" href="http://personal.maribol.ro/" target="_blank">here</a></p>
<p>Download: <a target="_blank" href="http://cl.ly/8VS2" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mlabs.info/maribol-personal-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.mlabs.info @ 2012-05-17 18:54:58 -->
