<?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>Full On Design &#187; Security</title>
	<atom:link href="http://www.fullondesign.co.uk/coding/security/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fullondesign.co.uk</link>
	<description>Design &#38; Web Technologies</description>
	<lastBuildDate>Sun, 30 Oct 2011 21:37:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Basic PHP Security</title>
		<link>http://www.fullondesign.co.uk/coding/security/571-basic-php-security.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/security/571-basic-php-security.htm#comments</comments>
		<pubDate>Fri, 27 Mar 2009 22:02:59 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[preg]]></category>
		<category><![CDATA[sessions]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=571</guid>
		<description><![CDATA[Saying &#8220;Don&#8217;t trust your users&#8221; would be a little over statement, but in the world of programming it&#8217;s the best mindset. Here are some really basic tips for programming in general (but mostly focusing on PHP). Validate All Input It&#8217;s very important to check all input to your script; a client could accidentally put a [...]]]></description>
			<content:encoded><![CDATA[<p>Saying &#8220;Don&#8217;t trust your users&#8221; would be a little over statement, but in the world of programming it&#8217;s the best mindset. Here are some really basic tips for programming in general (but mostly focusing on PHP).</p>
<h3>Validate All Input</h3>
<p>It&#8217;s very important to check all input to your script; a client could accidentally put a semi-colon in a field and possibly break your code. Always check that the user is posting what you expect. Here are some simple methods to validate input.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
// Input must be a number
if(is_numeric($input)){
	echo 'Input is a number';
} else {
	echo 'Input is not a number';
}

// Input can only contain numbers and letters.
if(preg_match('/([^A-z0-9])/', $input)){
	echo 'Input does not contain only numbers and letters.';
} else {
	echo 'Input contains only numbers and letters.';
}

// Input must be an email
if(preg_match('/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/', $input)){
	echo 'Email Is Valid.';
} else {
	echo 'Email Is Invalid.';
}
?&gt;</pre>
<h3>Hash Passwords</h3>
<p><a href="http://www.fullondesign.co.uk/coding/php/490-securing-passwords-in-php.htm">Hashing passwords</a> is mostly important from a privacy view point; if a hacker gets in they could sell your users details.</p>
<h3>Use Sessions, not cookies</h3>
<p>Never set sensitive data in cookies, users could edit them and potentially cause problems on your website. Instead use Sessions; they are a server side solution which is a little more secure.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
session_start(); // Start the session. Always put this at the top of your html.

// Set some sessions
$_SESSION['name'] = 'Example 1';

// echo session data
echo $_SESSION['name'];
// Would return Example 1
?&gt;</pre>
<p><span id="more-571"></span></p>
<h3>Related Links</h3>
<p><a href="http://www.amazon.co.uk/gp/product/0672329166?ie=UTF8&amp;tag=fulondes-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0672329166">PHP and MySQL Web Development (Developer&#8217;s Library)</a><br />
 <a href="http://www.webcheatsheet.com/php/regular_expressions.php">Using Regular Expressions with PHP</a><br />
 <a href="http://www.smashingmagazine.com/2008/11/18/10-advanced-php-tips-to-improve-your-progamming/">10 Advanced PHP Tips To Improve Your Programming</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/security/571-basic-php-security.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter in a Nutshell</title>
		<link>http://www.fullondesign.co.uk/uncategorized/517-twitter-in-a-nutshell.htm</link>
		<comments>http://www.fullondesign.co.uk/uncategorized/517-twitter-in-a-nutshell.htm#comments</comments>
		<pubDate>Fri, 20 Mar 2009 15:53:24 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Off-Topic]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=517</guid>
		<description><![CDATA[Click here to play Video]]></description>
			<content:encoded><![CDATA[<p><a href="http://current.com/items/89891774/supernews_twouble_with_twitters.htm"><img class="aligncenter size-full wp-image-531" title="twitter_in_a_nutshell" src="http://www.fullondesign.co.uk/wp-content/uploads/2009/03/twitter_in_a_nutshell.png" alt="twitter_in_a_nutshell" width="382" height="282" /></a></p>
<p style="text-align: center;"><a href="http://current.com/items/89891774/supernews_twouble_with_twitters.htm">Click here to play Video</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/uncategorized/517-twitter-in-a-nutshell.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing publicly available folders</title>
		<link>http://www.fullondesign.co.uk/coding/security/304-securing-publicly-available-folders.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/security/304-securing-publicly-available-folders.htm#comments</comments>
		<pubDate>Mon, 23 Feb 2009 20:48:03 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[stop hackers]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=304</guid>
		<description><![CDATA[Anyone who has ever developed a website which allows users to upload files will tell you &#8220;It&#8217;s best to think everyone is out to destroy your server&#8221;, which unfortunately is the best mindset to be in when setting up any website. One of the main methods used to by hackers to breach security on your [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who has ever developed a website which allows users to upload files will tell you &#8220;It&#8217;s best to think everyone is out to destroy your server&#8221;, which unfortunately is the best mindset to be in when setting up any website. One of the main methods used to by hackers to breach security on your website is to upload a file which allows them to execute code.</p>
<p>Here is a very quick and easy solution to stop potential hackers executing files in certain folders.</p>
<p>Open the .htaccess file in the folder you wish to protect and add the following code:</p>
<p><code>Options -Indexes <br />
 Options -ExecCGI <br />
 AddHandler cgi-script .php .php3 .php4 .phtml .pl .py .jsp .asp .htm .shtml .sh .cgi </code></p>
<p>This will essentially stop the folders returning an index of what is inside them and stop various files from running.</p>
<p><strong>Useful Links</strong></p>
<p><a href="http://www.mysql-apache-php.com/fileupload-security.htm" target="_blank">PHP File Upload Security</a><br />
 <a href="http://httpd.apache.org/docs/2.0/howto/htaccess.html" target="_blank">Apache Tutorial: .htaccess files</a><br />
 <a href="http://www.amazon.co.uk/gp/product/0764549693?ie=UTF8&amp;tag=fulondes-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0764549693">Apache, MySQL, and PHP Web Development All-in-one Desk Reference for Dummies</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.co.uk/e/ir?t=fulondes-21&amp;l=as2&amp;o=2&amp;a=0764549693" border="0" alt="" width="1" height="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/security/304-securing-publicly-available-folders.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing Links</title>
		<link>http://www.fullondesign.co.uk/coding/233-securing-links.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/233-securing-links.htm#comments</comments>
		<pubDate>Sat, 14 Feb 2009 21:49:14 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[click tracker]]></category>
		<category><![CDATA[secure links]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=233</guid>
		<description><![CDATA[Have you ever wanted to secure links on your website (for example hide the real source of a file)? Here is a quick and easy way to do this.]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to secure links on your website (for example hide the real source of a file)? Here is a quick and easy way to do this.</p>
<h3The Code</h3>
<pre class="brush: php; title: ; notranslate">&lt;?php # File created on 11th February 2009 by Mike Rogers (http://www.fullondesign.co.uk/). 

## Start defining constants ## 

define(RUN_ERRORS, TRUE); // Do you want the script to display errors? TRUE = yes you do.

define(redirect_or_echo, 'redirect'); // Do you want to redirect the user to another website, or just echo the other other webpages' content. 'rediect' will redirect, 'echo' will return the web pages constents. I recommend redirect.

## End defining constants ##

/* Start the link codes. The code is the ?code=123 part of the URL. The array should be fotmatted like:

$link['code'] = 'http://URL';

You may find it easier to do this with MySQL or including this as a seperate file. Too many links could lower performance, but for a small website just trying to cloak a few links this is good <img src='http://www.fullondesign.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> 

*/

$link['1'] = 'http://www.site.com/';

// Start the system.

function external_url($url){

    if($return = @file_get_contents($url)){

        return $return;

    }elseif(function_exists(&quot;curl_init&quot;)){

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_HEADER, 0);

        curl_setopt($ch, CURLOPT_TIMEOUT, 10);

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

        $return = curl_exec($ch);

        curl_close($ch);

        return $return;

    }elseif($return = @implode(&quot;&quot;, @file($url))){

        return $return;

    } else {

        return NULL;

    }

}

// Checks if the code is a number

if(is_numeric($_GET['code']) &amp;&amp; is_array($link)){

    if(isset($link[$_GET['code']])){

        if(redirect_or_echo === 'redirect'){

            header('location: '.$link[$_GET['code']]);

        } elseif(redirect_or_echo === 'echo'){

            echo external_url($link[$_GET['code']]);

        }else{

            if(RUN_ERRORS === TRUE){

                echo 'Sorry, an internal error has occoured.';    

            }

        }

    } else {

        if(RUN_ERRORS === TRUE){

            echo 'Sorry, the code you have provided is incorrect.';    

        }

    }

}else{

    if(RUN_ERRORS === TRUE){

        echo 'Sorry, the code you have provided is incorrect.';    

    }

}

/*

You are free to share, modify and use this code for commercial uses. Please give a link back (to http://www.fullondesign.co.uk/ ) if you can, but you don't have you.

You use this at your own risk.

*/

?&gt;</pre>
<p><a href="http://www.fullondesign.co.uk/wp-content/uploads/2009/02/link_cloaker.zip" target="_blank">Download the  Code</a></p>
<h3>Useful Links</h3>
<p><a href="http://uk2.php.net/" target="_blank">PHP’s Offical Website</a> &#8211; It has a fantastic documentation section. Well worth a look.<br />
<a href="http://www.amazon.co.uk/gp/product/032152599X?ie=UTF8&amp;tag=fulondes-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=032152599X">PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide</a><img style="border: medium none  ! important; margin: 0px ! important;" src="http://www.assoc-amazon.co.uk/e/ir?t=fulondes-21&amp;l=as2&amp;o=2&amp;a=032152599X" border="0" alt="" width="1" height="1" /> &#8211; The book I learnt PHP from, it’s really good for beginners and reference guide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/233-securing-links.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blocking users via .htaccess</title>
		<link>http://www.fullondesign.co.uk/coding/security/14-blocking-people-via-htaccess.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/security/14-blocking-people-via-htaccess.htm#comments</comments>
		<pubDate>Wed, 28 Jan 2009 22:25:53 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[allow]]></category>
		<category><![CDATA[deny]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=14</guid>
		<description><![CDATA[Every website has problems with users . Here is a cool way to ban users who prove to be annoying. Open your .htaccess file (should be above your public_html folder and you may need to show hidden files), then add the following: If you want to add more than one IP, just add an extra [...]]]></description>
			<content:encoded><![CDATA[<p>Every website has problems with users . Here is a cool way to ban users who prove to be annoying.</p>
<p>Open your .htaccess file (should be above your public_html folder and you may need to show hidden files), then add the following:</p>
<pre class="brush: php; title: ; notranslate">order allow,deny
deny from [IP here]
allow from all</pre>
<p>If you want to add more than one IP, just add an extra &#8220;deny from [ip here]&#8221; line. On the other hand, if you want to just let one person onto a website just use the following:</p>
<pre class="brush: php; title: ; notranslate">order allow,deny
allow from [IP here]
deny from all</pre>
<p>Allowing just a few IP&#8217;s to certain areas is useful when protecting administrator sections or user areas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/security/14-blocking-people-via-htaccess.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 1/26 queries in 0.013 seconds using disk: basic
Object Caching 394/455 objects using disk: basic

Served from: www.fullondesign.co.uk @ 2012-02-04 09:17:54 -->
