<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Prevent SQL Injections with PHP</title>
	<atom:link href="http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/</link>
	<description>Cycling, Motoring and Web Development.</description>
	<pubDate>Sun, 05 Jul 2009 00:28:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>By: Kamlesh Chaube</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-9041</link>
		<dc:creator>Kamlesh Chaube</dc:creator>
		<pubDate>Fri, 19 Jun 2009 13:10:58 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-9041</guid>
		<description>Great !!!
I like this help. 
Thanks,</description>
		<content:encoded><![CDATA[<p>Great !!!<br />
I like this help.<br />
Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vonnero</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-8034</link>
		<dc:creator>vonnero</dc:creator>
		<pubDate>Wed, 15 Apr 2009 18:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-8034</guid>
		<description>Great and direct to the point.... thanks</description>
		<content:encoded><![CDATA[<p>Great and direct to the point&#8230;. thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jesper</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-7608</link>
		<dc:creator>jesper</dc:creator>
		<pubDate>Wed, 11 Mar 2009 14:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-7608</guid>
		<description>http://jesperkampmann.com/prevent-sql-injection.html

This website has a code there automatic escape all incomming data:
_POST, _SESSION, _COOKIE, _GET, _FILE :-)</description>
		<content:encoded><![CDATA[<p><a href="http://jesperkampmann.com/prevent-sql-injection.html" rel="nofollow">http://jesperkampmann.com/prevent-sql-injection.html</a></p>
<p>This website has a code there automatic escape all incomming data:<br />
_POST, _SESSION, _COOKIE, _GET, _FILE <img src='http://woolie.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amatoc Industries</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-5777</link>
		<dc:creator>Amatoc Industries</dc:creator>
		<pubDate>Tue, 16 Dec 2008 07:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-5777</guid>
		<description>For making sure that something is an integer, you dont have to use the is_integer() function followed by an ugly OR DIE(). You can more simply just cast the input as an int using the following code:

$id = (int)$_GET['id'];

This casts the variable as one of type int. int variables cannot store any data other than ints. So... it is unable to store text. As such, malicious input such as 12' OR 1=1 ' would just become 12.

I use this method myself to sanitize int inputs and it works like a charm</description>
		<content:encoded><![CDATA[<p>For making sure that something is an integer, you dont have to use the is_integer() function followed by an ugly OR DIE(). You can more simply just cast the input as an int using the following code:</p>
<p>$id = (int)$_GET['id'];</p>
<p>This casts the variable as one of type int. int variables cannot store any data other than ints. So&#8230; it is unable to store text. As such, malicious input such as 12&#8242; OR 1=1 &#8216; would just become 12.</p>
<p>I use this method myself to sanitize int inputs and it works like a charm</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Android</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-4892</link>
		<dc:creator>Android</dc:creator>
		<pubDate>Thu, 13 Nov 2008 00:51:02 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-4892</guid>
		<description>Super, just what I needed. One question: If mysql_real_escape_string() takes care of the problem why do the numeric and length checks?</description>
		<content:encoded><![CDATA[<p>Super, just what I needed. One question: If mysql_real_escape_string() takes care of the problem why do the numeric and length checks?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Woolie</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-1406</link>
		<dc:creator>Woolie</dc:creator>
		<pubDate>Sun, 20 Apr 2008 22:41:42 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-1406</guid>
		<description>Hi Roel, as the notice at the top of this post states, the code used in this post may be out of date. Please make sure you verify with other sources before using it. 

To answer your question, no there is no real difference. The only thing I would note is that in the second one, to make the result exactly the same as the first, you may want to rewrite like so:

&lt;pre lang="php"&gt;
$result = mysql_query("SELECT* FROM animals WHERE name = $safe");
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Roel, as the notice at the top of this post states, the code used in this post may be out of date. Please make sure you verify with other sources before using it. </p>
<p>To answer your question, no there is no real difference. The only thing I would note is that in the second one, to make the result exactly the same as the first, you may want to rewrite like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #ff0000">$result</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">mysql_query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SELECT* FROM animals WHERE name = $safe&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Roel</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-1399</link>
		<dc:creator>Roel</dc:creator>
		<pubDate>Sun, 20 Apr 2008 07:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-1399</guid>
		<description>Is there a difference between:

 $query = "SELECT * FROM animals WHERE name = $safe";
 $result = mysql_query( $query );


$query = mysql_query("* FROM animals WHERE name = $safe");</description>
		<content:encoded><![CDATA[<p>Is there a difference between:</p>
<p> $query = &#8220;SELECT * FROM animals WHERE name = $safe&#8221;;<br />
 $result = mysql_query( $query );</p>
<p>$query = mysql_query(&#8221;* FROM animals WHERE name = $safe&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-354</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Wed, 25 Jul 2007 10:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-354</guid>
		<description>When you want to use a numeric value, you can just use this :

$id = (int)$_GET['id'];</description>
		<content:encoded><![CDATA[<p>When you want to use a numeric value, you can just use this :</p>
<p>$id = (int)$_GET['id'];</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johni</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-353</link>
		<dc:creator>johni</dc:creator>
		<pubDate>Thu, 31 May 2007 15:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-353</guid>
		<description>Great article, i must say simply the best!</description>
		<content:encoded><![CDATA[<p>Great article, i must say simply the best!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: harry</title>
		<link>http://woolie.co.uk/2007/01/prevent-sql-injections-with-php/#comment-352</link>
		<dc:creator>harry</dc:creator>
		<pubDate>Tue, 15 May 2007 06:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://woolie.co.uk/archives/115#comment-352</guid>
		<description>nice one dude</description>
		<content:encoded><![CDATA[<p>nice one dude</p>
]]></content:encoded>
	</item>
</channel>
</rss>
