<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>melbourne chapter</title>
	<link>http://www.melbournechapter.net/wordpress</link>
	<description>web application development with popular technologies</description>
	<pubDate>Fri, 18 Apr 2008 03:18:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>Taming Ordered Lists!</title>
		<link>http://www.melbournechapter.net/wordpress/web-accessibility/rich/2008/04/08/taming-ordered-lists/</link>
		<comments>http://www.melbournechapter.net/wordpress/web-accessibility/rich/2008/04/08/taming-ordered-lists/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 04:33:45 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>Web Accessibility</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/web-accessibility/rich/2008/04/08/taming-ordered-lists/</guid>
		<description><![CDATA[Ever wanted to have your own stylised numbers in an ordered list? Well using  CSS alone this is impossible - as far as i know - but with the help of PHP and list-style-image we can indeed use our own stylised numbers.  Anyway here&#8217;s how I do it:

&#60;ol&#62;
&#60; ?php
&#160;
var $pets = array(&#039;dog&#039;, &#039;cat&#039;, [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to have your own stylised numbers in an ordered list? Well using  CSS alone this is impossible - as far as i know - but with the help of PHP and list-style-image we can indeed use our own stylised numbers.  Anyway here&#8217;s how I do it:</p>
<pre>
&lt;ol&gt;
&lt; ?php
&nbsp;
var $pets = array(&#039;dog&#039;, &#039;cat&#039;, &#039;fish&#039;);
&nbsp;
for($i = 1; $i &lt;= count($pets); $i++) {
echo &#039;
  &lt;li&gt;&#039;.$pets[$i-1].&#039;
&#039;;
}
?&gt;
&lt;/ol&gt;
</pre>
<p>Of course you could use something other than a list like <a target="_blank" href="http://css-tricks.com/better-ordered-lists-using-simple-php-and-css/">this</a> , but that&#8217;s not semantic is it? Using the method  above  will mean even when the user has CSS disabled or images for that matter there will still be numbers!</p>
<p><strong>AMENDUM</strong></p>
<p>Well it appears I am wrong, there is a way of styling ordered lists in purely CSS and it&#8217;s so damn simple i cannot believe i overlooked it -  Thanks to <a target="_blank" href="http://stylizedweb.com/2008/03/12/most-used-css-tricks/">stylizedweb.com</a> for this snippet and Craig for pointing it out!</p>
<pre>ol {
font: italic 1em Georgia, Times, serif;
color: #999999;
}
ol p {
font: normal .8em Arial, Helvetica, sans-serif;
color: #000000;
}
&lt;ol&gt;
  &lt;li&gt;
This is line one&lt;/li&gt;
  &lt;li&gt;
Here is line two&lt;/li&gt;
  &lt;li&gt;
And last line&lt;/li&gt;
&lt;/ol&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/web-accessibility/rich/2008/04/08/taming-ordered-lists/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google GDay</title>
		<link>http://www.melbournechapter.net/wordpress/offtopic/rich/2008/04/01/google-gday/</link>
		<comments>http://www.melbournechapter.net/wordpress/offtopic/rich/2008/04/01/google-gday/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 23:53:14 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>Off Topic</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/offtopic/rich/2008/04/01/google-gday/</guid>
		<description><![CDATA[Whilst on google today I stumbled across Google GDay &#8220;predict content one day in advance&#8221; (http://www.google.com.au/intl/en/gday/index.html)  funny i thought  imagine how handy that would be for footy tipping or picking lotto numbers lol. Anyway for those of you haven&#8217;t figured it out already, yes its an April fools joke    but I wouldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst on google today I stumbled across Google GDay &#8220;predict content one day in advance&#8221; (http://www.google.com.au/intl/en/gday/index.html)  funny i thought  imagine how handy that would be for footy tipping or picking lotto numbers lol. Anyway for those of you haven&#8217;t figured it out already, yes its an April fools joke  <img src='http://www.melbournechapter.net/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  but I wouldn&#8217;t be too surprised if we do see something like this in the future <img src='http://www.melbournechapter.net/wordpress/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/offtopic/rich/2008/04/01/google-gday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DNS caching</title>
		<link>http://www.melbournechapter.net/wordpress/system-administration/rich/2008/03/03/dns-caching/</link>
		<comments>http://www.melbournechapter.net/wordpress/system-administration/rich/2008/03/03/dns-caching/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 06:00:20 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>System Administration</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/system-administration/rich/2008/03/03/dns-caching/</guid>
		<description><![CDATA[Interesting issue today whilst I was migrating some websites to a new host. Even after updating the DNS records with our domain name registrar we were still viewing old content, after much head scratching and blaming the internet connection we concluded there was some sort of caching going on. Didn&#8217;t make sense to me initially, [...]]]></description>
			<content:encoded><![CDATA[<p>Interesting issue today whilst I was migrating some websites to a new host. Even after updating the DNS records with our domain name registrar we were still viewing old content, after much head scratching and blaming the internet connection we concluded there was some sort of caching going on. Didn&#8217;t make sense to me initially, but after some relaxing tunes courtesy of Linkin Park and a coffee it dawned on me. DNS caching. In a nutshell Internet hosts, even your PC use our good friend the DNS server to resolve domains to webservers. To find out where the actual stuff is</p>
<p>(Lame re-enactment)</p>
<pre>
PC A: where&#039;s melbournechapter.net
&nbsp;
DNS A: anybody know where melbournechapter.net lives
&nbsp;
DNS B: its over here&#46;.. 123.45.67.89
&nbsp;
DNS A: cheers bud. Hey PC I just heard its over here .. 123.45.67.89
&nbsp;
PC A: Thanks.
&nbsp;
PC B: where&#039;s melbournechapter.net
&nbsp;
DNS A: Oh I know this one! It&#039;s over here 123.45.67.89
&nbsp;
[ later that day melbournechapter.net moves to a new address]</pre>
<p>Pretty mundane work I must say, and DNS A, our local DNS thinks so too. So rather than asking DNS B, our authorative DNS the location again it just sends PC B the address it previously got i.e. it uses its cached record. Meanwhile melbournechapter.net moved address so PC B gets the old location. Now usually this isn&#8217;t too much of a problem since a local DNS only remembers request for only a certain period known as TTL (Time To Live), so eventally DNS A will get the updated address. However, if your demonstrating something to a client you can get some rather strange results. Trust me when I say its pretty frustrating explaining you&#8217;ve updated something and all they can see through their browser is old content! Now to prevent this you can edit your registry or your clients registry for that matter but I dont recommend it! Instead just flush the DNS using ipconfig in Command Prompt (In XP Start > Run > Enter &#8220;cmd&#8221;):</p>
<pre>
C:Documents and Settingsrlee&gt; iponfig /flushdns</pre>
<p>And don&#8217;t forget to close and re-open the browser!
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/system-administration/rich/2008/03/03/dns-caching/feed/</wfw:commentRss>
		</item>
		<item>
		<title>auto_prepend_file - Parse PHP before the requested PHP loads</title>
		<link>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/22/auto_prepend_file-parse-php-before-the-requested-php-loads/</link>
		<comments>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/22/auto_prepend_file-parse-php-before-the-requested-php-loads/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 05:57:14 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>PHP</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/22/auto_prepend_file-parse-php-before-the-requested-php-loads/</guid>
		<description><![CDATA[Ever had to do some legacy hacking or changing of $_SERVER vars for different OS and wish you didn&#8217;t have to ruin your beautiful application? Well maybe auto_prepend_file is the answer! This is a little known core php directive, which when used  in a HTACCESS can let specify a php document to be parsed before [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had to do some legacy hacking or changing of $_SERVER vars for different OS and wish you didn&#8217;t have to ruin your beautiful application? Well maybe auto_prepend_file is the answer! This is a little known core php directive, which when used  in a HTACCESS can let specify a php document to be parsed before the document that has been called is parsed - and for every document in the given directory for that matter. Personally I&#8217;ve been using it to set constants which may/ or may not be set and for workarounds when libraries dont exits, but even more simple use it to include a global config file with paths to various assets etc for your website <img src='http://www.melbournechapter.net/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/22/auto_prepend_file-parse-php-before-the-requested-php-loads/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Placing JavaScript correctly</title>
		<link>http://www.melbournechapter.net/wordpress/programming-languages/javascript/rich/2008/02/12/placing-javascript-correctly/</link>
		<comments>http://www.melbournechapter.net/wordpress/programming-languages/javascript/rich/2008/02/12/placing-javascript-correctly/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 06:24:49 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>JavaScript</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/programming-languages/javascript/rich/2008/02/12/placing-javascript-correctly/</guid>
		<description><![CDATA[How often do you visit websites with script errors? Frequently my Firebug Firefox Add-On lights up with &#8220;undefined&#8221; errors when I visit JavaScript intensive websites. Sure it doesn&#8217;t affect the functionality of the site (usually) but it&#8217;s just plain bad form, specially when it&#8217;s so easily avoided. Where you place your JavaScript should depend on [...]]]></description>
			<content:encoded><![CDATA[<p>How often do you visit websites with script errors? Frequently my <a href="http://www.getfirebug.com">Firebug Firefox Add-On </a>lights up with &#8220;undefined&#8221; errors when I visit JavaScript intensive websites. Sure it doesn&#8217;t affect the functionality of the site (usually) but it&#8217;s just plain bad form, specially when it&#8217;s so easily avoided. Where you place your JavaScript should depend on how it is used in your site - Here&#8217;s some simple rules of thumb for placing JavScripts:</p>
<p>If the script needs to be run before the page is fully loaded to do some pre-processing for example such as browser and<br />
resolution checks place the script in the header as this is always loaded before content in the body:</p>
<pre>
&lt;head&gt;
&nbsp;
&lt;style type=&quot;text/css&quot; media=&quot;all&quot;&gt;
@import &quot;css/layout.css&quot;
&lt;/style&gt;
&lt;script language=&#039;text/javascript&#039;&gt;
&lt;!&#45;-
/*
For the purpose of example this script would load a stylesheet
based on the screen resolution.
*/
&nbsp;
var width = screen.width;
var height = screen.height;
if (width &lt; 1024) {
 document.write(&#039;&lt;style type=&quot;text/css&quot; media=&quot;all&quot;&gt;@import &quot;css/layout800&#215;600.css&quot;&#039;);
} else {
 document.write(&#039;&lt;style type=&quot;text/css&quot; media=&quot;all&quot;&gt;@import &quot;css/layout1024&#215;768.css&quot;&lt;/style&gt;&#039;);
}
// &#45;-&gt;
&lt;/script&gt;
&lt;/head&gt;
</pre>
<p>If the script manipulates html content the DOM must exist prior to the script execution. To make sure this is the case you can use the native window.onload() method which fires when the total document is loaded:</p>
<pre>
&lt;head&gt;
&lt;script language=&#039;text/javascript&#039;&gt;
&lt;!&#45;-
/*
For the purpose of example this script would create
a menu for the site
*/
&nbsp;
function init_menu() {
&nbsp;
   // do stuff here
&nbsp;
}
window.onload = init_menu();
//&#45;-&gt;
&lt;/script&gt;&lt;/head&gt;
</pre>
<p>Or placing you could place your script /function call later in the document - usually just before the closing body tag:</p>
<pre>
&nbsp;
&lt;script language=&#039;text/javascript&#039;&gt;
&lt;!&#45;-
init_menu();
// &#45;-&gt;
&lt;/script&gt;
</pre>
<p>I typically use the latter (before the closing body tag) because you can simply call multiple scripts relatively safely and avoid any window.onload() clashes since it is very possible other third-party scripts may be using this.</p>
<p><strong>Update:</strong></p>
<p>In addition to the above methods to make sure the DOM is loaded you can use the <a href="http://www.prototypejs.org/">Prototype</a> libraries <a href="http://www.prototypejs.org/api/document/observe">&#8220;DOM ready&#8221;, dom:loaded event observer</a> (which I have been using more recently) since it fires once the page markup has completed but before all the images etc have loaded:</p>
<pre>
document.observe(&#039;dom:loaded&#039;, function(){
 //any code here will be read once the DOM is ready, before images are loaded etc
});
</pre>
<p>And lastly, it&#8217;s always a good idea to check the DOM element(s) your targeting exist before you start manipulating them:</p>
<pre>
&lt;script language=&#039;text/javascript&#039;&gt;
&lt;!&#45;-
&nbsp;
var glider = document.getElementById(&#039;glider&#039;);
if (glider != undefined) {
   // do stuff
&nbsp;
}
// &#45;-&gt;
&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/programming-languages/javascript/rich/2008/02/12/placing-javascript-correctly/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flint Interactive</title>
		<link>http://www.melbournechapter.net/wordpress/offtopic/cman/2008/02/07/flint-interactive/</link>
		<comments>http://www.melbournechapter.net/wordpress/offtopic/cman/2008/02/07/flint-interactive/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 02:52:07 +0000</pubDate>
		<dc:creator>Cameron Manderson</dc:creator>
		
		<category>Off Topic</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/offtopic/cman/2008/02/07/flint-interactive/</guid>
		<description><![CDATA[
Cameron Manderson is working for Flint Interactive, a young, independent, Melbourne-based interactive collective, offering fresh and innovative end-to-end web services. Draw together by a common vision to create awesome, inspiring and progressive online projects, their work and the way they go about it reflects their passion. more&#8230;

]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flintinteractive.com.au/"><img border="0" src="http://www.melbournechapter.net/public/fi.gif" /></a></p>
<p>Cameron Manderson is working for <a href="http://www.flintinteractive.com.au/">Flint Interactive</a>, a young, independent, Melbourne-based interactive collective, offering fresh and innovative end-to-end web services. Draw together by a common vision to create awesome, inspiring and progressive online projects, their work and the way they go about it reflects their passion. <a href="http://www.flintinteractive.com.au/">more&#8230;</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/offtopic/cman/2008/02/07/flint-interactive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making Firefox 2.0.0* extensions work in Firefox 3.0.2*</title>
		<link>http://www.melbournechapter.net/wordpress/firefox/rich/2008/02/07/making-firefox-200-extensions-work-in-firefox-302/</link>
		<comments>http://www.melbournechapter.net/wordpress/firefox/rich/2008/02/07/making-firefox-200-extensions-work-in-firefox-302/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 00:10:32 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>Firefox</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/firefox/rich/2008/02/07/making-firefox-200-extensions-work-in-firefox-302/</guid>
		<description><![CDATA[I downloaded Firefox 3 beta 2 today. Give it a whirl i thought. But of course my beloved Web Developer and View Source Chart extensions were disabled because of incompatibility.  I was almost about to revert back to 2, but being the stubborn person I am sometimes, I didn&#8217;t believe it so I did [...]]]></description>
			<content:encoded><![CDATA[<p>I downloaded Firefox 3 beta 2 today. Give it a whirl i thought. But of course my beloved Web Developer and View Source Chart extensions were disabled because of incompatibility.  I was almost about to revert back to 2, but being the stubborn person I am sometimes, I didn&#8217;t believe it so I did a bit of Googling and low and behold i stumbled upon some <a target="_blank" href="https://addons.mozilla.org/en-US/firefox/discussions/comments.php?DiscussionID=6689">discussion on Mozilla about making the Greasemonkey add-on work under the new Firefox 3 beta </a> - and it turns out all you need to do is hack the installation manifest to change the version compatibility . To summarize here&#8217;s what you need do :</p>
<ol>
<li>Download the xpi file of your plugin by right-clicking on the Install Now button and selecting Save Link As</li>
<li>Right-click the downloaded my-extension-blah.xpi file and using <a href="http://www.7-zip.org/download.html">7-Zip</a> select Open Archive (.</li>
<li>Navigate to the install.rdf file and right-click and select Edit and find the <code>maxVersion</code> tag and change <code>2.0.0.*</code> to <code>3.0.2.*</code></li>
<li>Save your install.rdf file and close. Z-Zip will prompt if you want to update the archive so make sure you press &#8216;Yes&#8217;</li>
<li>Finally open the file in Firefox, or drag it into a blank tab and the installation procedure begins as per normal.</li>
</ol>
<p>Note: Please note i could only extract the and update the xpi package with 7-Zip, other zip programs didn&#8217;t repackage the xpi file properly, i kept getting errors when installing the package.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/firefox/rich/2008/02/07/making-firefox-200-extensions-work-in-firefox-302/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP 4 still kickin</title>
		<link>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/04/php-4-still-kickin/</link>
		<comments>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/04/php-4-still-kickin/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 03:04:44 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>PHP</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/04/php-4-still-kickin/</guid>
		<description><![CDATA[Earlier this month the PHP dev team released 4.4.8 a security/ stability patch, supposedly the last patch of the 4 branch*. I was pretty surprised, as to my knowledge official support of version 4 had finished as of 2007. I&#8217;ve always commended the PHP dev team on their ongoing support for PHP 4 since so [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this month the <a target="_blank" href="http://au2.php.net/downloads.php#v4">PHP dev team released 4.4.8</a> a security/ stability patch, supposedly the last patch of the 4 branch*. I was pretty surprised, <a href="http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2007/07/17/php4-to-be-discontinued-end-of-year/">as to my knowledge official support of version 4 had finished as of 2007</a>. I&#8217;ve always commended the PHP dev team on their ongoing support for PHP 4 since so many apps and shared hosts still support PHP 4, but as developers we must move on, familiarity breeds content as they say, so if your thinking of updating to 4.8.8 I strongly recommend you <a target="_blank" href="http://www.gophp5.org/">GoPHP5</a>.</p>
<p>Recommended reading on PHP 4 to PHP5 migration;</p>
<ul>
<li><a target="_blank" href="http://www.faqts.com/knowledge_base/view.phtml/aid/22154/fid/1150">FAQTs</a></li>
<li><a target="_blank" href="http://www.php.net/manual/en/migration5.ph">PHP dot Net Official Migration Docs</a></li>
<li><a target="_blank" href="http://www.derickrethans.nl/pres-breaking/talk.html"> Derick Rethan&#8217;s </a>(contributing PHP Dev Team Member)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/programming-languages/php/rich/2008/02/04/php-4-still-kickin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The facts about trailing slashes in URLs</title>
		<link>http://www.melbournechapter.net/wordpress/seo/rich/2008/01/17/the-facts-about-trailing-slashes-in-urls/</link>
		<comments>http://www.melbournechapter.net/wordpress/seo/rich/2008/01/17/the-facts-about-trailing-slashes-in-urls/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 03:29:03 +0000</pubDate>
		<dc:creator>Richard Lee</dc:creator>
		
		<category>SEO</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/seo/rich/2008/01/17/the-facts-about-trailing-slashes-in-urls/</guid>
		<description><![CDATA[Often when writing URL&#8217;s we put little thought into whether we add a trailing slash or not, especially these days with SEO where more concerned about the actual readability of the URL. The fact is webservers differentiate a request for a file and directory through the slash. When an incoming request comes through without a [...]]]></description>
			<content:encoded><![CDATA[<p>Often when writing URL&#8217;s we put little thought into whether we add a trailing slash or not, especially these days with SEO where more concerned about the actual readability of the URL. The fact is webservers differentiate a request for a file and directory through the slash. When an incoming request comes through without a trailing slash even if there&#8217;s no extension (i.e. www.mysite.com.au/home) the webserver first tries to  locate a file, only when its checked all files within the given directory does it then go on and check for a directory. While this is minor its still uneccessary overhead on the server when you consider a directory with hundreds of files.</p>
<p>So what does this mean in terms of SEO rewrites? Well not much because you can have whatever URL you want as long as you can translate it via some rule for the server. However, it is something to bear in mind if you dont want to give more meaning to your URLs. For instance, excluding this blog, these days for URL rewrites pointing to collections of things like Categories i usually end my URL&#8217;s with slashes category/politics/ and for single files I usually end my URLs with an  2008/01/17/keving07.html
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/seo/rich/2008/01/17/the-facts-about-trailing-slashes-in-urls/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Sharing sessions between multiple domains</title>
		<link>http://www.melbournechapter.net/wordpress/offtopic/cman/2007/12/13/php-sharing-sessions-between-multiple-domains/</link>
		<comments>http://www.melbournechapter.net/wordpress/offtopic/cman/2007/12/13/php-sharing-sessions-between-multiple-domains/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 21:46:35 +0000</pubDate>
		<dc:creator>Cameron Manderson</dc:creator>
		
		<category>Off Topic</category>

		<guid isPermaLink="false">http://www.melbournechapter.net/wordpress/offtopic/cman/2007/12/13/php-sharing-sessions-between-multiple-domains/</guid>
		<description><![CDATA[Hi All,
Some time ago I posted an article on what it would involve to share a session across different domains. I have since then had a lot of interest in having a look at a means of implementing the solution. It has been quite some time since I looked at the original solution (some 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Hi All,</p>
<p><a href="http://www.melbournechapter.net/wordpress/programming-languages/php/cman/2006/06/15/sharing-a-session-across-multiple-domainsservers-with-php/">Some time ago</a> I posted an article on what it would involve to share a session across different domains. I have since then had a lot of interest in having a look at a means of implementing the solution. It has been quite some time since I looked at the original solution (some 2 years ago) and I am posting the code free for all to use and to hopefully aid others in working on their solution for their projects.</p>
<p><strong>Implementation</strong></p>
<p>I use a majority of the time a MVC approach to my websites, namely following an Apache Struts implementation of which I hope to write more about in the next year. For this I am diverting all my requests through a single gateway that has configurations mapping to actions. As part of the framework I can modify the request processor or the boot process to handle session logic centrally for all requests.</p>
<p>The solution I was talking about would use one central server as an &#8216;issuing&#8217; server, and then all of the sub-sites (or other sites wishing to also share the session from across different domains) would request the session ID from this issuing server by redirecting to it instead of starting their own servers. The issuing server would then return the user to the original sub-site with a KEY to use to locate the session ID it should use, then the sub-sites would resume the session.</p>
<p>For this to work properly you would have to first centralise the database sessions, into a database is how my solution works (using ADODB at the time, these days I prefer PDO, but would be easy to rewrite). You would need 2 main components, one being the session handlers that operate on the sub-sites and the issuing script that operates on the issuing server.</p>
<p>In this example I assume you have a domain sub-site called &#8216;mysubsitedomain.com&#8217; and will use &#8216;mycentraldomain.com&#8217; as the issuing server.</p>
<p>You need two files:</p>
<p>- DistributedSessionWrapper.php<br />
- issueSessionId.php</p>
<p>Get the ZIP file here: <a href="http://cameronmanderson.clientstage.com.au/multiple-domain-sessions/multiple-session-example_v_1_0.zip">http://cameronmanderson.clientstage.com.au/multiple-domain-sessions/multiple-session-example_v_1_0.zip</a></p>
<p>Add to the sub-site &#8216;mysubsitedomain.com&#8217;:</p>
<blockquote><p><font face="Tahoma"> // Get a connection to the database<br />
$adodb = &#038; ADONewConnection(&#8217;mysql&#8217;);<br />
$connection = $adodb->PConnect($_db_host, $_db_user, $_db_password, $_db_name);<br />
if(!$connection) trigger_error(&#8217;Database not available&#8217;, E_USER_ERROR);</font></p>
<p>// Pass it to the session wrapper<br />
$session =&#038; DistributedSessionWrapper::getInstance();<br />
$session->sessionInit($adodb, &#8216;<a class="moz-txt-link-freetext" href="http://www.domain.com/issueSessionId.php">http://www.mycentraldomain.com/issueSessionId.php</a>&#8216;);</p>
</blockquote>
<p>And then on the central domain &#8216;mycentraldomain.com&#8217; setup the script issueSessionId.php</p>
<p>When a member hits mysubsitedomain.com and has the distributed session wrapper running it will redirect the request through to the issueSessionId script, which will then bounce the user back to mysubsitedomain.com with a lookup key to find the session ID that both scripts will agree to use [on different domains, but both will have a cookie configured with the same session ID].<br />
<strong>Downfalls</strong></p>
<p>There are some downfalls or challenges that I thought necessary to be expanded on my suggested code. Namely it is the requirement of expiring the session or regenerating a session ID and having it spawn across all the other servers. Theoretically we could use the current session with some flags identifying that the session has now expired or moved to another identifier. This would therefore require the sub-sites session handler to identify when they are using an expired session and change the session ID that it is using (or re-request a new one). There may be some downfalls with how we can run sessions, first looking at one session and then looking at another session.. but this may be done with a new request.</p>
<p>Also the redirect assumes that you can forward through the request to be resumed on the other servers. The problem with this is that it is currently passing through the request URI - which will only contain GET variables. This is a limitation I guess needs a bit of a work around, and may involve some additional communication between the scripts (or packaging of the post request to be resumed, maybe serialised temporarily?).</p>
<p>Also I wrote this script almost 2 years ago, so I probably should revisit it to work on the logic more. Maybe looking at the additional identification of no cookie support etc would help.<br />
Hopefully it is useful for someone to look at and be inspired into their own solution. Please email me at cameronmanders[-at-]gmail.com with your solution.<br />
Cheers<br />
Cameron
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.melbournechapter.net/wordpress/offtopic/cman/2007/12/13/php-sharing-sessions-between-multiple-domains/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
