<?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>Stuff by Sarah &#187; PHP Security</title>
	<atom:link href="http://www.stuffbysarah.net/category/php-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stuffbysarah.net</link>
	<description>PHP, WordPress and Business Ramblings</description>
	<lastBuildDate>Sun, 06 Jun 2010 12:45:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Secure Your Inputs</title>
		<link>http://www.stuffbysarah.net/2007/11/21/secure-your-inputs/</link>
		<comments>http://www.stuffbysarah.net/2007/11/21/secure-your-inputs/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 10:36:58 +0000</pubDate>
		<dc:creator>Sarah</dc:creator>
				<category><![CDATA[PHP Security]]></category>

		<guid isPermaLink="false">http://www.stuffbysarah.net/2007/11/21/secure-your-inputs/</guid>
		<description><![CDATA[One naivety that I often come across when having to update someone else&#039;s PHP code is that they&#039;ve assumed the form being posted to the script will be the form on the site that should be posting. For example, if you have a questionnaire on your website which has a list of questions and perhaps [...]]]></description>
			<content:encoded><![CDATA[<p>One naivety that I often come across when having to update someone else&#039;s PHP code is that they&#039;ve assumed the form being posted to the script will be the form on the site that should be posting. For example, if you have a questionnaire on your website which has a list of questions and perhaps a select list or radio buttons for a set of multiple choice answers. Too many PHP developers assume that the script that will deal with processing the results is going to get that specific form submitted to it, and not one that&#039;s virtually identical but submits from a different site, and instead of radio buttons it has a text input for each answer.</p>
<p>Another assumption is where the URL maybe contains a page ID to display and the developer has assumed that this page ID isn&#039;t going to be tampered with. I&#039;ve written in the past about <a href="http://www.stuffbysarah.net/blog/2006/03/18/secure-php-and-sql-injections/" class="internal">Secure PHP and SQL Injections</a>, and I&#039;ve seen people secure the input where they know it could be a mix of alphanumeric characters and symbols, however I&#039;ve also seen people <em>assume</em> that a variable should just be an integer therefore they don&#039;t secure it.</p>
<p>These are both common mistakes and the wrong ones to make!<br />
<span id="more-655"></span></p>
<h3>Securing Integers</h3>
<p>If you know that a value being passed to a script should only be an integer then you can easily secure this by saving the variable and using the <a href="http://www.php.net/manual/en/language.types.integer.php" class="external">(int)</a> cast. This is used as follows:</p>
<p><code>$a = (int)$_GET['pageid'];</code></p>
<p>The value of $a will then only be an integer and not contain anything else. If the pageid variable is tampered with and contains any other characters then the result will either be that $a will equal 0 or $a will equal a value providing that value is the first part of the variable. Sounds confusing doesn&#039;t it. Let me explain by example:</p>
<p><code>$b = "I have 10 green bottles";<br />
$a = (int)$b; // would make $a equal to nothing<br />
$b = "10 green bottles";<br />
$a = (int)$b; // would make $a equal to 10</code></p>
<p>So as you can see, the first version of $b contains text first so the (int) cast would make $a equal to zero. However the second version of $b has the integer at the start, so everything after this would be stripped out, leaving $a equal to 10.</p>
<p>Of course, if you rely on $a having a value then you need to check it still has one after the cast. Putting this into an if statement is then easily done. Let&#039;s say for example your site uses the pageid variable to determine which page to display. If the pageid variable is zero then we&#039;ll want the front page displaying, however we&#039;ll also want to make sure the visitor is on the front page, so we can redirect them.</p>
<p><code>if ((int)$_GET['pageid']) :<br />
   $id = (int)$_GET['pageid'];<br />
else :<br />
   $id = 1;<br />
endif;</code></p>
<p>This simple statement checks to see whether the integer of the pageid variable is valid. If the result of using the (int) cast is greater than zero then the $id variable will get the pageid value saved to it, else it will get the value of 1 which is assumed to be your index page. This could also be written as:</p>
<p><code>$id = (int)$_GET['pageid'];<br />
if (!$id) :<br />
   $id = 1;<br />
endif;</code></p>
<p>Remember, if a variable is equal to zero then as a boolean it is considered as false, it is also considered as empty (annoying when you have a required form field and someone enters a zero as the value).</p>
<p>So that&#039;s variable casting. It&#039;s a quick and easy way to secure any integer input.</p>
<h3>Check for the Expected</h3>
<p>Going back to my original example, imagine a form that has a select list. Let&#039;s say it&#039;s a simple contact form and at the bottom it has a list to allow people to select one option to say how they found the site (a waste of time in my opinion but clients still request it!). So your HTML code would look like the following:</p>
<p><code>&lt;label for="findus"&gt;How did you find us?&lt;/label&gt;<br />
&lt;select id="findus" name="findus"&gt;<br />
 &lt;option value="Search Engine"&gt;Search Engine&lt;/option&gt;<br />
 &lt;option value="Another Site"&gt;Another Site&lt;/option&gt;<br />
 &lt;option value="From a Friend"&gt;From a Friend&lt;/option&gt;<br />
 &lt;option value="Other">Other&lt;/option&gt;<br />
&lt;/select&gt;</code></p>
<p>In a safe and kind world we would just expect that someone would complete the form and the script that processes it would just need to accept the $_POST['findus'] value and perhaps input it into a database table or put it in an email. However, we don&#039;t use a safe and kind internet unfortunately. We live in a world where 15 year old kids want to hack sites, inject rubbish into our database tables, or spammers want to submit their rubbish via every form going, regardless of whether you need a new fake Rolex or various tablets <img src='http://www.stuffbysarah.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>There are 3 ways to process this data. The naive route, assuming that the only data that the $_POST['findus'] variable will contain is one of those 4 options. I see this all the time on sites I take over from others, or people asking for help with their code and you cringe when you read their PHP. <strong>Do not assume the form posted is yours!!!</strong> Okay I&#039;ve said it now. You cannot assume the form that is posted will contain the HTML that I wrote above. If your action URL is say http://www.yoursite.com/contact-us.php then any form or spam program on the web can post to that. Just because you&#039;ve said that the findus variable is a select list on your form, doesn&#039;t mean that Spammer A or Hacker B is going to treat the variable with the same respect. So you need to secure everything, not just text inputs, especially if you&#039;re going to enter this information into a database table.</p>
<p>The second way to process this data is to run the variable through an <a href="http://www.stuffbysarah.net/blog/2006/03/18/secure-php-and-sql-injections/" class="internal">escapeString function</a>. This will then secure the variable before entering it into a database table (note, if you&#039;re just emailing the information then this method of securing isn&#039;t really needed).</p>
<p>However, the third and most suitable process is to check that what has been submitted is <strong>what has been expected</strong>. Spammers will often submit the correct form variables but they will contain completely different values than they should. If you have a select list of 4 items then why not just compare the value received with one of these values to make sure there is a match? This is easily done with an array. First off you store the values in an array:</p>
<p><code>$findusValues = array("Search Engine", "Another Site", "From a Friend", "Other");</code></p>
<p>Then in your processing script you can use the <a href="http://www.php.net/in_array" class="external">in_array()</a>  to check to see if the value of the posted variable exists in the findusValues array.</p>
<p><code>if (!in_array($_POST['findus'], $findusValues)) :<br />
   //value isn't in the array so create error message here<br />
endif;</code></p>
<p>If the value of $_POST['findus'] contains anything other than what is in the array then the if statement will be false and your error processing should take over. Of course it would be silly to leave the HTML for the select list as above as a simple typing error could cause problems for people. Plus why repeat something when a few lines of code will take of it?</p>
<p><code>&lt;label for="findus"&gt;How did you find us?&lt;/label&gt;<br />
&lt;select id="findus" name="findus"&gt;<br />
&lt;?php<br />
foreach ($findusValues AS $value) :<br />
   echo "&lt;option value='".$value."'&gt;".$value."\n";<br />
endforeach;<br />
?&gt;<br />
&lt;/select&gt;</code></p>
<p>Of course this means that the array $findusValues needs to be defined in the page that contains the form. I general tend to have a form submit to itself and the processing goes on above the HTML doctype. This way if there is a problem it&#039;s easy enough to redisplay the values in the form and allow the user to correct their mistakes. So the order of the page would be</p>
<ul>
<li>Define Array</li>
<li>Form processing script</li>
<li>HTML output including form</li>
</ul>
<h3>Summary</h3>
<p>I&#039;ll admit that I&#039;ve been naive in the past. When I first learnt PHP I didn&#039;t realise such things as SQL injections existed. The book I learnt from never told me that. Then when I was introduced to the <a href="http://www.php.net/addslashes" class="external">addslashes()</a> function I was the same as most newbie PHP developers and assumed that radio buttons, checkboxes and select lists, all values that were predefined, would be fine and not need checking. As a newbie PHPer I certainly wish someone had told me these things earlier on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stuffbysarah.net/2007/11/21/secure-your-inputs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Secure PHP and SQL Injections</title>
		<link>http://www.stuffbysarah.net/2006/03/18/secure-php-and-sql-injections/</link>
		<comments>http://www.stuffbysarah.net/2006/03/18/secure-php-and-sql-injections/#comments</comments>
		<pubDate>Sat, 18 Mar 2006 21:48:05 +0000</pubDate>
		<dc:creator>Sarah</dc:creator>
				<category><![CDATA[Learn PHP]]></category>
		<category><![CDATA[PHP Security]]></category>

		<guid isPermaLink="false">http://www.stuffbysarah.net/2006/03/18/secure-php-and-sql-injections/</guid>
		<description><![CDATA[I spent the last 1-2 weeks upgrading a site for a client and also securing it. How are a lot of PHP sites compromised? Well the point I&#039;m looking it in this post is via forms and user entered data. There are many other security issues as well, this is just one of them. More [...]]]></description>
			<content:encoded><![CDATA[<p>I spent the last 1-2 weeks upgrading a site for a client and also securing it. How are a lot of PHP sites compromised? Well the point I&#039;m looking it in this post is via forms and user entered data. There are many other security issues as well, this is just one of them. More commonly known as SQL Injections. <a href="http://www.php.net" class="external">PHP.net</a> has a good page on this subject explaining <a href="http://www.php.net/manual/en/security.database.sql-injection.php" class="external">SQL Injection</a> giving real life examples. As per their description:</p>
<blockquote><p>Direct SQL Command Injection is a technique where an attacker creates or alters existing SQL commands to expose hidden data, or to override valuable ones, or even to execute dangerous system level commands on the database host. This is accomplished by the application taking user input and combining it with static parameters to build a SQL query.</p></blockquote>
<p>So what does this mean? When you have a form on a page requesting user input and then use this input in MySQL queries you must not rely on what the user has entered. 99% of the time when you ask a user for their username and password, they will enter this. However along comes someone who wants to crack your system, suddenly you won&#039;t be receiving a username and password through the form but most likely code aimed to inject extra operations into your MySQL query. Perhaps it&#039;s easier to understand by way of example.  My own logins usually accept a username and password from a form. The usual method is to accept a username and password and then run a SELECT statement to count the number of records that contain both the username and password. If the result is zero then the username and/or password is of course incorrect. A loosely written PHP script could be:</p>
<dl class="code">
<dt>Insecure code to control user login</dt>
<dd>
<ol>
<li>$sql = mysql_query(&#034;SELECT COUNT(*) FROM users WHERE username = &#039;&#034;.<strong>$_POST['username']</strong>.&#034;&#039; AND password = &#039;&#034;.<strong>$_POST['password']</strong>.&#034;&#039;&#034;);</li>
<li>$count = mysql_fetch_row($sql);</li>
<li>if ($count[0] == 0) {</li>
<li class="indent1">// user/password combo incorrect</li>
<li class="indent1">$errormsg = &#034;Your Username and/or Password are incorrect. Please try again&#034;;</li>
<li>} else {</li>
<li class="indent1">// user/password combo correct proceed with login</li>
<li class="indent1">header(&#034;Location:http://www.domain.com/secret/logged-in.php&#034;);</li>
<li class="indent1">exit;</li>
<li>}</li>
</ol>
</dd>
</dl>
<p>As you can see from the above, the user input from the $_POST array is entered straight into the query. Oh and</p>
<dl class="code">
<dt>Insecure code to control user login</dt>
<dd>
<ol>
<li>$username = $_POST['username'];</li>
<li>$password = $_POST['password'];</li>
<li>$sql = mysql_query(&#034;SELECT COUNT(*) FROM users WHERE username = &#039;&#034;.<strong>$username</strong>.&#034;&#039; AND password = &#039;&#034;.<strong>$password</strong>.&#034;&#039;&#034;);</li>
<li>&#8230;</li>
</ol>
</dd>
</dl>
<p>is no different <img src='http://www.stuffbysarah.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>So how can this be an issue? Well, all of your registered users will most likely enter their username and password. No issue there. Your MySQL statement would look like this:</p>
<dl class="code">
<dt>SQL Statement</dt>
<dd>
<ol>
<li>SELECT COUNT(*) FROM users WHERE username = &#039;sarah&#039; AND password = &#039;sunshine&#039;</li>
</ol>
</dd>
</dl>
<p>However, a visitor wanting to crack your system could enter the following information:</p>
<blockquote><p>
username: sarah<br />
password: &#039; or &#039;1&#039;=&#039;1
</p></blockquote>
<p>Which would give:</p>
<dl class="code">
<dt>SQL Injection Code</dt>
<dd>
<ol>
<li>SELECT COUNT(*) FROM users WHERE username = &#039;sarah&#039; AND password = &#034; or &#039;1&#039; = &#039;1&#039;</li>
</ol>
</dd>
</dl>
<p>The above would return the total number of records in the table. So going by the very loosely written PHP script above, the if statement of</p>
<dl class="code">
<dt>IF Statement</dt>
<dd>
<ol>
<li>if ($count[0] == 0) {</li>
<li class="indent1">&#8230;</li>
<li>} else {</li>
<li class="indent1">&#8230;</li>
<li>}</li>
</ol>
</dd>
</dl>
<p>would provide a value from $count[0] to be above zero (providing there were records in the table), thus giving someone a login without a proper username or password.</p>
<p>Okay so yes, the example is a highly unsecure example, but it does happen. Plenty of people believe that providing there is no direct link to a file on a server, it won&#039;t be found out. Trouble is it can be. So pulling the above example apart the first steps security would be</p>
<p>1. Ensure all restricted pages check that the member is logged in by using cookies or sessions or both.<br />
2. Switch the if statement to ensure that only one record is found and allow the user to log in from that, otherwise assume the username/password is wrong and prevent the login.<br />
3. Escape the user entered data.</p>
<p>At this point I&#039;ll briefly mention <a href="http://www.php.net/magic_quotes" class="external">Magic Quotes</a> which is a setting in the php configuration file that can be set to on or off. If set to on then it will escape all user entered data, using the same method as the function <a href="http://www.php.net/addslashes" class="external">addslashes()</a>. It was introduced due to the amount of people who don&#039;t escape their user entered data, however it causes nightmares for most PHP developers and is even stated on the PHP.net site that most developers will choose to turn it off, preferring to escape the data when required. However on most shared hosting it&#039;s not necessarily easy to do this as you have no control over the php.ini file, so the best way is to check to see if Magic Quotes are on, clean the variable if they are (using <a href="http://www.php.net/stripslashes" class="external">stripslashes()</a> function) and then escape the variable. The function that I use (courtesey of <a href="http://www.jellyandcustard.com" class="external">Khalid</a> is:</p>
<dl class="code">
<dt>escapeString Function</dt>
<dd>
<ol>
<li>function escapeString($string) {</li>
<li class="indent1">if (get_magic_quotes_gpc()) $string = stripslashes($string);</li>
<li class="indent1">return mysql_real_escape_string($string);</li>
<li>}</li>
</ol>
</dd>
</dl>
<p>Here this function uses the <a href="http://www.php.net/mysql_real_escape_string" class="external">mysql_real_escape_string()</a> built in function. The function will add a backslashes to the beginning of any of the characters \x00, \n, \r, \, &#039;, &#034; and \x1a. This will protect you from any SQL injections thus protecting your database.</p>
<p>However don&#039;t be fooled into thinking that when I say &#034;user entered data&#034; that I just mean text inputs. Going back to the site I secured last week the original developers had not thought about a couple of issues, which could be have been used in conjunction with one another and allowed someone to wreak havoc on the site or in the database. Considering the site accepted money this is even more important to ensure its security. What was wrong?</p>
<p>Firstly they were storing the user&#039;s id and password in cookies. Not necessarily a problem however they were then taking the raw data from the cookies and using it to query the database. Cookies can be edited therefore must be escaped. Then some user entered data was being escaped (but not as securely as the function above will do) but other data wasn&#039;t. The site had even had a security update before me and there was still an emerging pattern. When a page had some secured data on it, the unsecured data wasn&#039;t secured because the form variables were from checkboxes, radio buttons or a select list. I admit, when I first start out writing PHP I figured that this information couldn&#039;t be tampered with therefore didn&#039;t require securing. However take a normal form that&#039;s there for people to complete and the details go into a database. A questionnaire for example. Plenty of input boxes, radio buttons, check boxes and select lists. The form is submitted to perhaps the same page or another page. We know full well that another completely unrelated site could submit to that php script as well. Take the same form names, which are plain to see in the HTML source, but then instead of a radio button having a prespecified value suddenly someone could submit to the processing script a radio button with their own value.</p>
<p>The simple rule is, never trust data that could have been tampered with. If it&#039;s coming from $_GET, $_POST, $_COOKIE or even $_SERVER (after all if the user agent or http referrer can be altered who knows what it would be altered to?) then escape it. These are the 4 I deal with, if there are any further global arrays that should be escaped feel free to add to this list.</p>
<p>For people who use ASP, this <a href="http://www.sitepoint.com/article/sql-injection-attacks-safe" class="external">Site Point article</a> will be of use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stuffbysarah.net/2006/03/18/secure-php-and-sql-injections/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP: Secure Form Mailing</title>
		<link>http://www.stuffbysarah.net/2006/02/14/php-secure-form-mailing/</link>
		<comments>http://www.stuffbysarah.net/2006/02/14/php-secure-form-mailing/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 22:48:14 +0000</pubDate>
		<dc:creator>Sarah</dc:creator>
				<category><![CDATA[PHP Security]]></category>

		<guid isPermaLink="false">http://www.stuffbysarah.net/2006/02/14/php-secure-form-mailing/</guid>
		<description><![CDATA[CGI forms have been notorious for abuse by spammers. The most used one of all is the famous formmail.cgi script. Most people have either moved on to other more secure scripts or turned to PHP for emailing their forms. That&#039;s all well and good however PHP can be abused just as much. I started to [...]]]></description>
			<content:encoded><![CDATA[<p>CGI forms have been notorious for abuse by spammers. The most used one of all is the famous formmail.cgi script. Most people have either moved on to other more secure scripts or turned to PHP for emailing their forms. That&#039;s all well and good however PHP can be abused just as much. I started to receive a lot of spam through the script on my business site a few weeks ago so I put in a simple trap in the script which checks the content entered before emailing it to me and returning the visitor to a thank you page. If the trap is triggered the visitor gets set to Google.com instead (bye bye!). Nothing&#039;s been received since. I&#039;ll go into the trap more in my PHP learning section when I start to explore string functions.</p>
<p>However the other day I received an attempt to use my web form to spam others. Below is a copy of the email I received, with the intended recipient&#039;s email blanked out. I&#039;ve added an X in the middle of my domain to prevent other spambots picking it up, and XXX to the IP recorded.</p>
<blockquote><p>
From: sift4526@3emediaX.co.uk<br />
Company: sift4526@3emediaX.co.uk<br />
Telephone: sift4526@3emediaX.co.uk<br />
Mobile: moonlight<br />
Content-Type: multipart/mixed; boundary=b3b8beb3795e1c824f717fcad62d230f<br />
MIME-Version: 1.0<br />
Subject: the<br />
bcc: cxxxxxxxx9@aol.com</p>
<p>This is a multi-part message in MIME format.</p>
<p>&#8211;b3b8beb3795e1c824f717fcad62d230f<br />
Content-Type: text/plain; charset=\&#034;us-ascii\&#034;<br />
MIME-Version: 1.0<br />
Content-Transfer-Encoding: 7bit</p>
<p>pa apers ivry mornin . ayciption at th hite ouse. mong th casulties was so<br />
&#8211;b3b8beb3795e1c824f717fcad62d230f&#8211;</p>
<p>.</p>
<p>Fax: sift4526@3emediaX.co.uk<br />
Location: sift4526@3emediaX.co.uk<br />
Country: sift4526@3emediaX.co.uk<br />
E-mail: sift4526@3emediaX.co.uk<br />
Query: sift4526@3emediaX.co.uk</p>
<p>IP: XXX.174.190.170
</p></blockquote>
<p>So that&#039;s what I received. Why didn&#039;t it work? Well I control the headers of my script and set it to come from my web site and not the address entered in the from box. I originally did this because I don&#039;t believe that everyone has an email address (my Dad doesn&#039;t for a start!) and also just because I decided I wanted to control the headers more to be recognisable in my spam programs. However after a check with a very knowledgeable <a href="http://www.jellyandcustard.com" class="external">friend</a> I&#039;ve also learnt my script is more than secure (yay!). It sounds bizarre maybe that I&#039;m saying this but until the above email I&#039;ve never had or seen an attempt on what is commonly known as a header injection. Since the spamming happened I started to grab the IPs of the users too so the attempt has been emailed to the abuse address of the IP owner and the IP has now been blocked from my web site.</p>
<p>Last week I had a client email me in a panic. A form mailer that his previous developer had set up had been disabled by his host as it was being used for spamming and sure enough there was the typical, most used method of sending email using PHP:</p>
<p><code><br />
mail("client@hisdomain.com", "Web Form Results", $msgbody, "From: $name &lt;$email&gt;");<br />
</code></p>
<p>I changed this to</p>
<p><code><br />
mail("client@hisdomain.com", "Web Form Results", $msgbody, "From: client@hisdomain.com");<br />
</code></p>
<p>So how can you be careful? Well in my opinion the best way to be truly careful is to prevent anything that is associated with visitor input to go into your email headers. This way you have complete control and there are no security risks whatsoever. However that is not always how clients want it, they like to just be able to hit reply to an email and reply back to the potential customer. So therefore some extra security checks or spam traps as I like to call them, need to be in place.</p>
<p>Instead of writing out various methods of what to do there&#039;s a great page from <a href="http://www.jellyandcustard.com/2006/02/24/email-header-injection-in-php/" class="external">Khalid</a> that offers a few validation functions which should help you check the email given is valid.</p>
<p>There are other methods and checks that can be made. More will be introduced in my PHP Learning category as and when I get to the functions involved. But for now secure your scripts as much as possible!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stuffbysarah.net/2006/02/14/php-secure-form-mailing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Input Validation</title>
		<link>http://www.stuffbysarah.net/2005/12/21/input-validation/</link>
		<comments>http://www.stuffbysarah.net/2005/12/21/input-validation/#comments</comments>
		<pubDate>Wed, 21 Dec 2005 14:38:50 +0000</pubDate>
		<dc:creator>Sarah</dc:creator>
				<category><![CDATA[Learn PHP]]></category>
		<category><![CDATA[PHP Security]]></category>

		<guid isPermaLink="false">http://www.stuffbysarah.net/2005/12/21/input-validation/</guid>
		<description><![CDATA[PHP Input Validation to protect your site]]></description>
			<content:encoded><![CDATA[<p>PHP, if done wrongly can leave your site and subsequently the server that your site is hosted on, open to attack. There are various security measures you can take to limit the possibility of this happening.</p>
<p>Khalid over at Jelly and Custard has started to write a few tutorials on this subject. To save me writing them too, go read his post on <a href="http://www.jellyandcustard.com/2005/12/21/variable-casting/" class="external">Variable Casting</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stuffbysarah.net/2005/12/21/input-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
