
<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, Web and IT stuff &#187; PHP</title>
	<atom:link href="http://www.webdigi.co.uk/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdigi.co.uk/blog</link>
	<description>Little words of wisdom</description>
	<lastBuildDate>Sat, 04 Sep 2010 22:35:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Analytics for Facebook Fan Pages</title>
		<link>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/</link>
		<comments>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:25:08 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Facebook Pages]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=639</guid>
		<description><![CDATA[We launched our Facebook fan page earlier this month and as with all Facebook pages only Facebook Insights program is available to page administrators. Facebook Insights shows demographic details and interactions on your pages BUT limited to show information of fans only. It is far less sophisticated and comprehensive when compared to the free Google Analytics. One of [...]]]></description>
			<content:encoded><![CDATA[<p>We launched our Facebook <a href="http://facebook.com/webdigi">fan page</a> earlier this month and as with all Facebook pages only Facebook Insights program is available to page administrators. Facebook Insights shows demographic details and interactions on your pages BUT limited to show information of fans only. It is far less sophisticated and comprehensive when compared to the free Google Analytics. One of the limitations of Facebook Fan pages is that you can only run limited Javascript on it and Google Analytics needs Javascript code included to correctly track visitors. We have successfully managed to get ALL functions of Google Analytics working on our Facebook fan page (including visitor statistics, traffic sources, visitor country, keyword searches with all other powerful reporting &amp; maps overlays etc).</p>
<div id="attachment_640" class="wp-caption aligncenter" style="width: 285px"><img class="size-medium wp-image-640  " title="analytics-example" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2010/02/analytics-example-275x300.jpg" alt="Google Analytics Example" width="275" height="300" /><p class="wp-caption-text">Google Analytics Example</p></div>
<p style="text-align: center;"><strong> </strong></p>
<p style="text-align: center;"><strong> </strong></p>
<p style="text-align: center;"><strong> </strong></p>
<p><strong>How to setup Google Analytics on your Facebook fan pages</strong></p>
<p>The workaround we use in our code is to include Google Analytics as an image instead of setting the standard Javascript. This method tracks every visitor to the custom facebook pages on Google Analytics. It required a combination of server side cookie management and an additional &lt;img&gt; tag to the bottom of the facebook fan page. Here are the steps to get Google Analytics working on your facebook fan page.</p>
<p>1) Setup Google Analytics account. If you already have one, create a new website profile. You can name it facebook.com or facebook.com/your_page_name. You will finally get your tracking code which looks like this UA-3123123-2<br />
2) Create your custom img tag for <strong>each </strong>of your pages you like to track. EG: contact form, services, products etc. You can use our tool to create the <a href="http://ga.webdigi.co.uk">Google Analytics link generator for Facebook pages</a>.<br />
3) Add the entire custom image html tag from step 2 to the bottom of each Facebook fan page that you need to track.<br />
<strong></strong></p>
<p>That is all there is to it! Google Analytics is not real-time, so you will need to give it some time. Approximately a day before you see the fruits of your &#8220;hard&#8221; work.</p>
<p><strong>For advanced users</strong></p>
<p>Use this method, if you don&#8217;t want to use our hosted link redirection as mentioned in the method above. You can download the entire source code which is just about three files to get this setup working on your own server (running PHP4.3 or above). The code is written in PHP and essentially creates the Google image tracking URL with the referrer, page information, ID, etc. The additional advantage of hosting this on your own server and domain is that visits from your website to your facebook fan page gets tracked, etc. You will also be able to customise further if you wish. Please do share any useful updates you apply to the tracking link code.</p>
<p><a href="http://www.webdigi.co.uk/blog/apps/fbgat-facebook-google-analytics-tracker/">Facebook &#8211; Google Analytics Tracker v1.1</a> (Updated 21st Feb, 2010).  For advanced method &#8211; Download this code to use on your server.</p>
<p>If you don&#8217;t have a Facebook fan page yet, visit our tutorial for code and help on <a href="http://www.webdigi.co.uk/blog/2010/creating-a-custom-facebook-page/">creating customised Facebook fan pages</a>.</p>
<p>PS: We could not find any other source / blog that described how to get Google Analytics on Facebook fan pages! There is support for canvas pages and applications but nothing for StaticFBML fan pages. Hope this helps and please leave your comments below.</p>
<p>UPDATE:<br />
1) A lot of users have asked how to track visits to the wall. Yes, this can be done. Please see the comments by iphp below.<br />
2) Here is a <a href="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/06/adding-img-tag.png">screenshot to a staticFBML</a> where the code should be placed<br />
3) We have managed to <a href="http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/">set up funnels, goals and segments to separate fan and non fan activity</a>.<br />
4) This blog and comments cover all aspects of setting up Google Analytics. If you still want help, we are available to offer paid support and installation of Analytics for your page. Please <a href="http://www.webdigi.co.uk/contactus.php">contact us here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/feed/</wfw:commentRss>
		<slash:comments>221</slash:comments>
		</item>
		<item>
		<title>Run PHP on the Google App Engine</title>
		<link>http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 22:25:26 +0000</pubDate>
		<dc:creator>php-manual</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[quercus]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=313</guid>
		<description><![CDATA[
Google launched their Google App Engine (GAE) a year ago. The free hosting in App Engine is allocated 500 MB of persistent storage and enough CPU and bandwidth for about 5 million page views a month. Also, if you really want more you can see pricing plans.
GAE will support Java going forward. Unfortunately PHP support on the App [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter size-full wp-image-659" title="Google Appengine Running PHP" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/04/appengine-java-php.jpg" alt="Google Appengine Running PHP" width="640" height="417" /></p>
<p>Google launched their <a rel="nofollow" href="http://code.google.com/appengine/">Google App Engine</a> (GAE) a year ago. The <strong>free</strong> hosting in App Engine is allocated <strong>500 MB</strong> of persistent storage and enough CPU and bandwidth for about <strong>5 million page views</strong> a month. Also, if you really want more you can see <a rel="nofollow" href="http://code.google.com/appengine/kb/billing.html#freequota">pricing plans</a>.</p>
<p>GAE will support <a rel="nofollow" href="http://googleappengine.blogspot.com/2009/04/seriously-this-time-new-language-on-app.html">Java going forward</a>. Unfortunately <a rel="nofollow" href="http://code.google.com/p/googleappengine/issues/list">PHP support on the App Engine</a> is still left as the top item in the wishlist. So until Google announces their official PHP support we have a workaround to run PHP using <a rel="nofollow" href="http://www.caucho.com/resin-3.0/quercus/">Quercus</a>. Quercus is basically a 100% Java implementation of the PHP language (requires JDK 1.5).  Since the App Engine now supports Java this means we can use Quercus to run PHP scripts on the App Engine.</p>
<p><span style="text-decoration: underline;">So all you need to use the GAE and run PHP</span><br />
1) Register a <a rel="nofollow" href="http://appengine.google.com/">free account</a>.<br />
2) <a href="http://www.webdigi.co.uk/fun/php-appengine/phpwithjava.zip">Download this file</a> to your computer.<br />
3) Edit application XML tag in the file war\WEB-INF\appengine-web.xml to the name of the application you have registered.<br />
4) Finally <a href="http://code.google.com/appengine/docs/java/gettingstarted/uploading.html">upload your application</a>. I downloaded Google App Engine <strong>SDK for Java</strong> and use the following command in windows.<br />
appcfg.cmd update C:\projects\phpwithjava\war</p>
<p>To see this in action just visit:<br />
<a href="http://phpwithjava.appspot.com/webdigi.php">http://phpwithjava.appspot.com/webdigi.php</a> and <a href="http://phpwithjava.appspot.com/info.php">http://phpwithjava.appspot.com/info.php</a></p>
<p>NOTE: phpwithjava is my app name with GAE. Image by Aral Balkan.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>78</slash:comments>
		</item>
		<item>
		<title>What is new in PHP 5.3 for PHP amateurs?</title>
		<link>http://www.webdigi.co.uk/blog/2009/what-is-new-in-php-53-for-php-amateurs/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/what-is-new-in-php-53-for-php-amateurs/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 19:33:59 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[lambdas]]></category>
		<category><![CDATA[namespaces]]></category>
		<category><![CDATA[phar]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=256</guid>
		<description><![CDATA[In a recent PHP conference in London some great speakers spoke about new features in PHP to be released in PHP 5.3. PHP 5.3 contains functionality that was scheduled for PHP 6, which takes PHP 5.3 from being a minor release to a significant and huge release. A release that no PHP developer should ignore. [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent <a rel="nofollow" href="http://www.phpconference.co.uk/">PHP conference in London</a> some great speakers spoke about new features in PHP to be released in PHP 5.3. PHP 5.3 contains functionality that was scheduled for PHP 6, which takes PHP 5.3 from being a minor release to a significant and huge release. A release that no PHP developer should ignore. Most of these features are pretty complicated additions for novice PHP programmers. I have listed some features and some ways to use them.</p>
<p><strong>1) Namespaces for classes and functions</strong><br />
This feature will help us shorten the class names and function names. To appreciate this feature, we need to go back to the days before there was Object Oriented Programming in PHP. Imagine all the function names with name save(). How would you differentiate if the call save() was to save a blogs or save comments? The solution was to use blog_save() or comment_save() before the introduction of classes in which we could write the save() function within the Blog class or the Comment class. Using classes is obviously a much more elegant solution.</p>
<p>We now have the same situation with the large number of classes and functions. Using namespaces, we could simply separate the two functions above in the code below:</p>
<pre name="code" class="php">

&lt;?php
namespace Blog;
function save()
{
echo &quot;Now saving the blog!&quot;;
}

namespace Comment;
function save()
{
echo &quot;Now saving the comment!&quot;;
}

// To invoke the functions
Blog\save();    // This prints - Now saving the blog!
Comment\save(); // This prints - Now saving the comment!
?&gt;
</pre>
<p>EDIT: A final decision was made on October 2008.  Developers will have to use \ backslash operator to dereference namespaces.</p>
<p><strong>2) MySQL Native Driver</strong><br />
PHP 5.3 has a native driver specific to PHP, optimised for the ZEND engine. It is an alternative to connect to MySQL server versions newer than 4.1. Being a native driver we should be able to get much faster execution times. The native driver will also be licensed under the PHP license. If you are like most users, you are currently using libmysql (A MySQL database client library) you will be able to easily switch over to mysqlnd <strong>without</strong> making any changes to your existing PHP Scripts!<br />
<strong><br />
3) phar &#8211; PHp ARchive</strong><br />
This is a cool new feature.  Think of it like an archive, like a .zip file or a .tar file. Besides just being able to group all the files into one simple file, we will be able to deliver and run an entire PHP application from a single file!</p>
<p>We will also be able to use phar archives within PHP, so the following will work in PHP 5.3 and above</p>
<pre name="code" class="php">

&lt;?php
include &quot;singlefilelibrary.phar&quot;
?&gt;
</pre>
<p>Obviously, there will be a performance hit but the possibilities are endless, imagine being able to upload phpMyAdmin to the server as a single phar file instead of hundreds of small files.</p>
<p><strong>4) Closures &amp; Lambdas</strong><br />
This gets into the list because this is something most web developers would have been familiar with while working on Javascript. A lambda can be declared anywhere and they can be assigned to a variable. A closure on the other hand are lambda funcions but have access to the variables where they were declared. This is something called lexical scoping. To see this in action take a look at this example.</p>
<pre name="code" class="php">

&lt;?php
$hellolambda = function () {
echo &quot;Hello world via Lambda&quot;;

}
$hellolambda(); // Outputs Hello world via Lambda
?&gt;
</pre>
<p><strong>5) All of the rest!</strong><br />
There are a lot of other things in PHP 5.3 which I thought are nice, I have just described all of them very succinctly.<br />
<em><strong>Functors:</strong> </em>This allows an object to be invoked as a function.<br />
<strong><em>Traits:</em> </strong>This is a new unit of reuse, traits can be incomplete, provides reusability, modularity and structure. In short it is copy-paste glorified!<br />
<strong><em>Magic functions: </em> </strong>We have a couple of new magic functions for classes (interceptors) __callstatic() and invoke()<br />
<strong><em>Ternary operator:</em> </strong>You can now display the a value that exists $value1 or $value2 using this simple statement<em> </em>echo $value1?:$value2;<br />
There are many more things added like Late Static Binding, Variable Static Calls, Changes to PHP Error Levels, new PHP functions, improvements to help with OpenID, Command line and many more.</p>
<p><strong>Final Thought</strong><br />
Well, this gives us much more to play with. It is definitely a lot to include into PHP 5.3 and I would have expected so many changes to go into PHP 6. I sometimes wonder if there will be anything new left to add into PHP 6 given the fact that so much has been released already.  If you are interested in PHP 5.3, do give it a try <a title="Link to PHP 5.3" rel="nofollow" href="http://qa.php.net/">here</a>, it is in beta at the time of the writing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/what-is-new-in-php-53-for-php-amateurs/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>PHP on Windows Server 2008 : 500 &#8211; Internal Server Error on IIS</title>
		<link>http://www.webdigi.co.uk/blog/2009/php-on-windows-server-2008-500-internal-server-error-on-iis/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/php-on-windows-server-2008-500-internal-server-error-on-iis/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 18:13:00 +0000</pubDate>
		<dc:creator>iphp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[IIS 7.0]]></category>
		<category><![CDATA[Server Error]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=59</guid>
		<description><![CDATA[Recently we had to work on a Windows server 2008 (web edition) machine with IIS 7.0 and we ran into the strangest of errors. The server stops running the script with this message :  
Server Error 
500 &#8211; Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Cause:
 [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we had to work on a Windows server 2008 (web edition) machine with IIS 7.0 and we ran into the strangest of errors. The server stops running the script with this message :  </p>
<p><strong>Server Error <br />
<span style="font-weight: normal;">500 &#8211; Internal server error.<br />
There is a problem with the resource you are looking for, and it cannot be displayed.<strong><img class="size-full wp-image-62" title=" Internal Server Error - Windows Server 2008" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/01/server500.png" alt=" Internal Server Error - Windows Server 2008" width="654" height="145" /><br />
Cause:</strong></span></strong></p>
<p><strong> <span style="font-weight: normal; ">This error happens on the default configuration of windows server 2008. The server logs do not say a lot except for the fact that the php file is causing an error. This happens for the following reasons on the server:</span></strong></p>
<ul>
<li>PHP Fatal error (Something that you did or didn&#8217;t do caused the server to run into a fatal error)</li>
<li>PHP error_reporting is on and there are some errors (Anything from a NOTICE or WARNING can cause this)</li>
</ul>
<p> <br />
<strong>How to rectify:</strong></p>
<p><strong> </strong></p>
<p><strong><span style="font-weight: normal;">Obviously the best way to resolve the error is find out what is wrong with the PHP code. But how do you do this if the server won&#8217;t show you what the error is? One of the best ways to find what is wrong with your PHP script is to try to login to the machine via RDP. This works only if you have remote desktop access. Once in RDP try to go to the same URL but using the server&#8217;s Internet explorer. Accessing the server locally will avoid the 500 Internal Server Error and show you what is wrong with the PHP file as on a development environment. The server just shows you the PHP error messages and the rest of your script output is not shown.</span></strong></p>
<p><strong>Change IIS 7.0 Setting<br />
<span style="font-weight: normal;">Alternatively to the above, you can always change the configuration using the Configuration Editor of IIS 7.0. You will find this under the Section &gt; system.webServer/httpErrors. You have to change errorMode to </span>Detailed </strong>from the usual DetailedLocalOnly and then click on Apply.</p>
<p>This is a good security measure as it will not accidentally show your PHP errors to the users of your system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/php-on-windows-server-2008-500-internal-server-error-on-iis/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>How to detect if your webserver is hacked and get alerted</title>
		<link>http://www.webdigi.co.uk/blog/2009/how-to-detect-if-your-webserver-is-hacked-and-get-alerted/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/how-to-detect-if-your-webserver-is-hacked-and-get-alerted/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 15:36:53 +0000</pubDate>
		<dc:creator>php-manual</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=31</guid>
		<description><![CDATA[We all do our best to write excellent code and also keep our installations of popular open source tools like Wordpress, Joomla, Oscommerce, Drupal, phpmyadmin and all its plugins always updated to prevent any attack or hackers using known exploits on them. This article is not aimed at going through all those methods to help you secure [...]]]></description>
			<content:encoded><![CDATA[<p>We all do our best to write excellent code and also keep our installations of popular open source tools like Wordpress, Joomla, Oscommerce, Drupal, phpmyadmin and all its plugins always updated to prevent any attack or hackers using known exploits on them. This article is not aimed at going through all those methods to help you secure your website BUT focuses on how to send you an alert once your website is hacked and running &#8220;hidden&#8221; code that you didnt write.</p>
<p><span id="more-31"></span></p>
<p><span style="text-decoration: underline;">The problem</span></p>
<p>Once hackers get into your website either by exploiting known vulnerabilities in any of the installed programs OR by getting FTP access to your server, the first thing they usually do is to plant backdoor scripts to log them in again at a later date. They need some executable script on the server to gain access to MySQL passwords, installation passwords or even edit settings in your wordpress or other installations.  We have also seen situations where the site was left largely unchanged except for malicious javascript code added to the bottom of the index.php or index.html files.</p>
<p>So in short the bad guys have taken over your server and running anything from a backdoor script or launching phishing attacks or sending tons of spam emails. You will not know that your server is hacked until you get blacklisted on spamhaus or your customers get redirected to some random site or worser still when you are contacted by ebay/paypal/some bank saying that your website is phisihing their customers. <strong>The problem is that we dont even have an idea that our site is hacked until it is too late or too embrassing.</strong></p>
<p><span style="text-decoration: underline;">Simple Solution &#8211; Website Change Detection System</span></p>
<p>We need a script on the server that detects any changes or to any executable file on the server or any new file on the server from HTML, JS, to PHP, ASP, Perl, Python files etc.  If we generate a <strong>hash </strong>value of all our files and then compare them periodically, then we will be able to detect when our codebase has changed on the server.</p>
<p>These are the steps that our change detection system performs (It takes about 500ms to execute on a typical server):</p>
<ol>
<li>Load configuration file (contains password, exclude list)</li>
<li>Check password from request before starting (recommended)</li>
<li>Recursively run through every file and sub folder on the server within the current directory of the script.</li>
<li>Generate a hash for each file and arrive at the master hash.</li>
<li>Compare master hash with hash the user has and alert if different!</li>
</ol>
<p>Notes:</p>
<ul>
<li>This script at this simple level is almost 100% fool proof in detecting changes to the codebaes give that the hacker or bots don&#8217;t know of websiteCDS presence.</li>
<li>At this stage the script cannot detect SQL injection attacks and changes to code that are saved to the database.</li>
<li>The users hash is not stored on the server at any time, the comparison with master hash can be done at cron script level or using siteup as discussed below.</li>
</ul>
<p>We have the following code written in PHP but you can do the same with any other scripting language to perform similar checks. We have started the project under google code and is available here: <a title="websiteCDS version in PHP" href="http://websitecds.googlecode.com/files/websitecds%20version1.zip" target="_blank">PHP code for WebsiteCDS</a><br />
See the readme file in the download for help with setup.</p>
<p><span style="text-decoration: underline;">Different ways to automate the alert system</span></p>
<p>Method 1: Using our trusted cron job<br />
A cron job can be setup to run the website CDS, compare the results with the last known valid hash and send out an email alert.</p>
<p>Method 2: With Siteup<br />
Siteup is a free tool for windows systems that can be set to periodically check if your website is reachable. This is recommended for those of us who don&#8217;t want to setup a cron job. It can be downloaded here <a rel="nofollow" href="http://www.xequte.com/other/index.html#siteup"  target="_blank">http://www.xequte.com/other/index.html#siteup</a> We can use this to frequently call our change detection system and then use the siteup word search to check if the hash value is the same as what we have from our last codebase update. ( <a title="websiteCDS setup in SiteUP" href="http://blogcdn.webdigi.co.uk.s3.amazonaws.com/blog/wp-content/uploads/2009/screenshot/SiteUPeditSite.jpg" target="_blank">See screenshot</a> )</p>
<p>NOTE: The project &amp; code included is the first version of the change detection system and kindly submit your ideas and comments here or an issue or feature request in <a title="WebsiteCDS issue tracking" href="http://code.google.com/p/websitecds/issues/list" target="_blank">google code project for websitecds</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/how-to-detect-if-your-webserver-is-hacked-and-get-alerted/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>PHP session fixation attacks</title>
		<link>http://www.webdigi.co.uk/blog/2009/php-session-fixation-attacks/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/php-session-fixation-attacks/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 12:45:05 +0000</pubDate>
		<dc:creator>php-manual</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=6</guid>
		<description><![CDATA[Session fixation attacks attempt to exploit the vulnerability of a system which allows one person to fixate (set) another person's session identifier (SID). Most session fixation attacks are web based, and most rely on session identifiers being accepted from URLs (query string) or POST data.]]></description>
			<content:encoded><![CDATA[<p>Session fixation attacks attempt to exploit the vulnerability of a system which allows one person to fixate (set) another person&#8217;s session identifier (SID). Most session fixation attacks are web based, and most rely on session identifiers being accepted from URLs (query string) or POST data.</p>
<p><span style="text-decoration: underline;">Example of such an attack</span>: Lets take an example of a banking website which provides login to access banking features. (this can be any site which allows users to login).<br />
EG: http://www.poorbanking.com</p>
<p>1) Hacker<br />
Creates a very a link and sends visitors to the site as http://www.poorbanking.com/index.php?PHPSESSID=1234<br />
Lets assume PHPSESSID is the name of the cookie / variable used to store session information. It is very easy for anyone to find this by just visiting the site once.</p>
<p>2) Hacker sends link to the target user.<br />
http://www.poorbanking.com/index.php?PHPSESSID=1234 by email or placed in a blog etc.</p>
<p>3) Victim<br />
Sees the link and clicks on it. The site looks genuine and the victim logs in to the site. At this stage the PHPSESSID is set to PHPSESSID=1234 and user is logged in.</p>
<p>4) The happy hacker<br />
Hacker can keep checking if they can login by simply going to http://www.poorbanking.com/showmeaccount.php?PHPSESSID=1234<br />
where showmeaccount.php is the page after login. They can see that once the user has logged in they can easily get access to the page.</p>
<p><span style="text-decoration: underline;">Work around to this problem</span></p>
<p>Just prior to setting such a session variable, a call to session_regenerate_id() can help to protect against a session fixation attack.</p>
<p>See more information at http://en.wikipedia.org/wiki/Session_fixation</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/php-session-fixation-attacks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
