<?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: Securing User Input in PHP</title>
	<atom:link href="http://www.query7.com/securing-user-input-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://query7.com/securing-user-input-in-php/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Sat, 22 Nov 2008 07:22:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Panzer</title>
		<link>http://query7.com/securing-user-input-in-php/#comment-217</link>
		<dc:creator>Panzer</dc:creator>
		<pubDate>Mon, 21 Apr 2008 19:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.query7.com/?p=19#comment-217</guid>
		<description>Thats a good point, about not being able to use mysql_real_escape if you don't use MySQL in the first place.</description>
		<content:encoded><![CDATA[<p>Thats a good point, about not being able to use mysql_real_escape if you don&#8217;t use MySQL in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Web Development Blog</title>
		<link>http://query7.com/securing-user-input-in-php/#comment-216</link>
		<dc:creator>Web Development Blog</dc:creator>
		<pubDate>Mon, 21 Apr 2008 19:09:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.query7.com/?p=19#comment-216</guid>
		<description>Its an alright function, but you can't alway use mysql_real_escape_string, when it comes down to input security.  Some sites might not use sql.  Also, you might need to check if magic quotes is on before stripping slashes :).

Heres something I've writing in the past.

function input_sanatize($data,$trim=true,$type=1)
{
	if( is_array($data) )
	{
		for($x=0;$x&#60;sizeof($data);$x++)
		{
			$data[$x] = input_sanatize($data[$x],$trim,$type);
		}
		return $data;
	}
	else
	{
		$data = get_magic_quotes_gpc() ? stripslashes($data) : $data;
		$data = $trim === true ? trim($data) : $data;
		switch( $type )
		{
			case 1:
				$data = mysql_real_escape_string($data);
				break;
			case 2:
			default:
				$data = htmlentities($data, ENT_QUOTES,'UTF-8');
				break;
		}
	}
	return $data;
}

Regards,
-Lamonte</description>
		<content:encoded><![CDATA[<p>Its an alright function, but you can&#8217;t alway use mysql_real_escape_string, when it comes down to input security.  Some sites might not use sql.  Also, you might need to check if magic quotes is on before stripping slashes :).</p>
<p>Heres something I&#8217;ve writing in the past.</p>
<p>function input_sanatize($data,$trim=true,$type=1)<br />
{<br />
	if( is_array($data) )<br />
	{<br />
		for($x=0;$x&lt;sizeof($data);$x++)<br />
		{<br />
			$data[$x] = input_sanatize($data[$x],$trim,$type);<br />
		}<br />
		return $data;<br />
	}<br />
	else<br />
	{<br />
		$data = get_magic_quotes_gpc() ? stripslashes($data) : $data;<br />
		$data = $trim === true ? trim($data) : $data;<br />
		switch( $type )<br />
		{<br />
			case 1:<br />
				$data = mysql_real_escape_string($data);<br />
				break;<br />
			case 2:<br />
			default:<br />
				$data = htmlentities($data, ENT_QUOTES,&#8217;UTF-8&#8242;);<br />
				break;<br />
		}<br />
	}<br />
	return $data;<br />
}</p>
<p>Regards,<br />
-Lamonte</p>
]]></content:encoded>
	</item>
</channel>
</rss>
