<?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>Kevin Pajak - Interactive Web Developer/Designer - BLOG</title>
	<atom:link href="http://www.kevinpajak.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinpajak.com/blog</link>
	<description>Creative visionary, digital entrepreneur.</description>
	<lastBuildDate>Tue, 13 Apr 2010 02:01:02 +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>My online &#8220;test community&#8221; is now up!</title>
		<link>http://www.kevinpajak.com/blog/2010/04/12/my-online-test-community-is-now-up/</link>
		<comments>http://www.kevinpajak.com/blog/2010/04/12/my-online-test-community-is-now-up/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 01:57:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>
		<category><![CDATA[Social Media]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=399</guid>
		<description><![CDATA[Hey everybody! My &#8220;Web 2.0 style&#8221; online test community is now up. Please feel free to check it out &#038; share any feedback you may have. Thanks a bunch!]]></description>
			<content:encoded><![CDATA[<p>Hey everybody! My &#8220;Web 2.0 style&#8221; <a href="http://www.kevinpajak.com/apps/community/"><b>online test community</b></a> is now up. Please feel free to <a href="http://www.kevinpajak.com/apps/community/">check it out</a> &#038; share any feedback you may have. Thanks a bunch!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/04/12/my-online-test-community-is-now-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to delete entire folders/sub-folders (with all files contained within) in PHP</title>
		<link>http://www.kevinpajak.com/blog/2010/03/31/how-to-delete-entire-folderssub-folders-with-all-files-contained-within-in-php/</link>
		<comments>http://www.kevinpajak.com/blog/2010/03/31/how-to-delete-entire-folderssub-folders-with-all-files-contained-within-in-php/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 08:40:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=395</guid>
		<description><![CDATA[Thanks to PeejAvery @CodeGuru.com for turning me on to this one (with the original code here). Here&#8217;s the code: function rrd($directory, $empty=FALSE){ if(substr($directory,-1) == &#8216;/&#8217;){$directory = substr($directory,0,-1);} if(!file_exists($directory) &#124;&#124; !is_dir($directory)){return FALSE;} elseif(!is_readable($directory)){return FALSE;} else{ $handle = opendir($directory); while (FALSE !== ($item = readdir($handle))){ if($item != &#8216;.&#8217; &#38;&#38; $item != &#8216;..&#8217;){ $path = $directory.&#8217;/&#8217;.$item; if(is_dir($path)){rrd($path);} else{unlink($path);} [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to PeejAvery @<a href="http://www.codeguru.com/forum/archive/index.php/t-366823.html" target="_blank"><b>CodeGuru.com</b></a> for turning me on to this one (with the <a href="http://lixlpixel.org/recursive_function/php/recursive_directory_delete/" target="_blank">original code here</a>).</p>
<p>Here&#8217;s the code:<span id="more-395"></span></p>
<p>function rrd($directory, $empty=FALSE){<br />
if(substr($directory,-1) == &#8216;/&#8217;){$directory = substr($directory,0,-1);}<br />
if(!file_exists($directory) || !is_dir($directory)){return FALSE;}<br />
elseif(!is_readable($directory)){return FALSE;}<br />
else{<br />
$handle = opendir($directory);<br />
while (FALSE !== ($item = readdir($handle))){<br />
if($item != &#8216;.&#8217; &amp;&amp; $item != &#8216;..&#8217;){<br />
$path = $directory.&#8217;/&#8217;.$item;<br />
if(is_dir($path)){rrd($path);}<br />
else{unlink($path);}<br />
}<br />
}<br />
closedir($handle);<br />
if($empty == FALSE){if(!rmdir($directory)){return FALSE;}}<br />
return TRUE;<br />
}<br />
}</p>
<p>(Just make sure you add a direct call to the PHP function, or you&#8217;ll get an error. Here&#8217;s how I did that:</p>
<p>Put <em>rrd($username, $empty=FALSE);</em> just beneath the function <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>Happy coding everybody.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/03/31/how-to-delete-entire-folderssub-folders-with-all-files-contained-within-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;International Kevin Appreciation Day&#8221;</title>
		<link>http://www.kevinpajak.com/blog/2010/03/16/international-kevin-appreciation-day/</link>
		<comments>http://www.kevinpajak.com/blog/2010/03/16/international-kevin-appreciation-day/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 03:31:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=379</guid>
		<description><![CDATA[Have you hugged a Kevin today? Yes that&#8217;s right, I have decided to be audacious and pompous enough to declare today, March 16 as &#8220;International Kevin Appreciation Day&#8221;! :p A day ahead of St. Patrick&#8217;s Day (which you have probably heard of ), I just thought I would take this brief (and albeit light-hearted) opportunity [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left;"><IMG SRC="http://www.kevinpajak.com/images/lepr1.gif"></div>
<p><em>Have you hugged a Kevin today?</em></p>
<div style="clear: left;"></div>
<p>Yes that&#8217;s right, I have decided to be audacious and pompous enough to declare today, March 16 as &#8220;International Kevin Appreciation Day&#8221;! :p A day ahead of St. Patrick&#8217;s Day (which you have probably heard of <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ), I just thought I would take this brief (and albeit <em>light-hearted</em>) opportunity to tell you that, in my humble, though biased opinion, I have to say that Kevins in general kick ass, are cool, and are true (primarily) to the original Celtic roots of their name, which stems from the ancient Gaelic word &#8220;caoin,&#8221; meaning &#8220;tender, gentle, and kind&#8230;.&#8221;</p>
<p>So, on that note, I return you to your &#8220;regular programming,&#8221; and I wish all of you a very happy and lucky St. Patrick&#8217;s Day tomorrow! <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> .</p>
<div style="float: right;"><IMG SRC="http://www.kevinpajak.com/images/leprechaun.gif"></div>
<div style="clear: right;"></div>
<p>[images obtained from <A HREF="http://www.fg-a.com/StPatsday.htm" target="_blank">this site</A>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/03/16/international-kevin-appreciation-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress plugins and widgets</title>
		<link>http://www.kevinpajak.com/blog/2010/02/16/wordpress-plugins-and-widgets/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/16/wordpress-plugins-and-widgets/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 09:33:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>
		<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[Word Press]]></category>
		<category><![CDATA[wordpress plugins]]></category>
		<category><![CDATA[wordpress widgets]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=374</guid>
		<description><![CDATA[I will make some WordPress plugins and widgets, and already thinking of possibly using them to &#8220;plug in&#8221; some of the aspects of my app dev work in various capacities, if site requirements call for it or could use it .]]></description>
			<content:encoded><![CDATA[<p>I will make some WordPress plugins and widgets, and already thinking of possibly using them to &#8220;plug in&#8221; some of the aspects of my app dev work in various capacities, if site requirements call for it or could use it <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/16/wordpress-plugins-and-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>David Sylvian Tribute on MySpace</title>
		<link>http://www.kevinpajak.com/blog/2010/02/16/david-sylvian-tribute-on-myspace/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/16/david-sylvian-tribute-on-myspace/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 08:56:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[coolness]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=372</guid>
		<description><![CDATA[David Sylvian, in addition to having been the lead singer of the &#8217;70s band Japan, has recorded and toured with many top musicians throughout his eclectic career, including avant-garde guitarist Robert Fripp (King Crimson), Ryuichi Sakamoto, guitarist Bill Frisell, tabla player Talvin Singh, and others. His latest project is called Manafon. &#8220;Maybe I’m attracted to [...]]]></description>
			<content:encoded><![CDATA[<p><A HREF="http://en.wikipedia.org/wiki/David_Sylvian" target="_blank"><B>David Sylvian</B></A>, in addition to having been the lead singer of the &#8217;70s band Japan, has recorded and toured with many top musicians throughout his eclectic career, including avant-garde guitarist Robert Fripp (King Crimson), Ryuichi Sakamoto, guitarist Bill Frisell, tabla player Talvin Singh, and others.</p>
<p>His latest project is called <A HREF="http://www.manafon.com/" target="_blank"><B>Manafon</B></A>.</p>
<blockquote><p>&#8220;Maybe I’m attracted to the stories of individuals who search for meaning on their own terms,&#8221; says Sylvian. &#8220;But what I’m fascinated by is the devotion to a creative discipline. The meaning with which the work imbues the life regardless of its reception and, to a certain extent, its importance.&#8221; Sylvian’s search is endless, and maybe quixotic. The fruits of the journey are unknowably rich.</p></blockquote>
<p>Check out this <A HREF="http://www.myspace.com/davidsylviantribute" target="_blank"><B>David Sylvian Tribute on MySpace</B></A></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/16/david-sylvian-tribute-on-myspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modified a couple of Twitter list titles I follow</title>
		<link>http://www.kevinpajak.com/blog/2010/02/15/modified-a-couple-of-twitter-list-titles-i-follow/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/15/modified-a-couple-of-twitter-list-titles-i-follow/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 04:34:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=369</guid>
		<description><![CDATA[Changed the titles of a couple of Twitter lists I follow: Changed &#8220;Web Designers&#8221; to Web/Graphic Designers; changed &#8220;Social Media&#8221; to Social Media/Tech News.]]></description>
			<content:encoded><![CDATA[<p>Changed the titles of a couple of <A HREF="http://twitter.com/kevinpajak/lists" target="_blank"><B>Twitter lists I follow</B></A>:</p>
<p>Changed &#8220;Web Designers&#8221; to <A HREF="http://twitter.com/kevinpajak/web-graphic-designers" target="_blank"><B>Web/Graphic Designers</B></A>; changed &#8220;Social Media&#8221; to <A HREF="http://twitter.com/kevinpajak/social-media-tech-news" target="_blank"><B>Social Media/Tech News</B></A>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/15/modified-a-couple-of-twitter-list-titles-i-follow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to replace a backslash character in a string</title>
		<link>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 08:36:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=363</guid>
		<description><![CDATA[Ah, so often it&#8217;s the little things eh&#8230; PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the mysqli_real_escape_string function). The problem of course is that the text the user enters nicely protects you from [...]]]></description>
			<content:encoded><![CDATA[<p>Ah, so often it&#8217;s the little things eh&#8230;</p>
<p>PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the <em>mysqli_real_escape_string</em> function). The problem of course is that the text the user enters nicely protects you from a MySQL database injection, BUT the text then comes back full of backslash (\) characters (not too cool looking huh). So, to remove these, you can use the following code (here, I use the PHP <em>str_replace</em> function:</p>
<p>// Convert escaped characters back to regular text<br />
$string = str_replace(&quot;\\&quot;, &quot;&quot;, $string);</p>
<p>Thanks to Geoff Muldoon for this one!:<br />
<A HREF="http://www.bigresource.com/Tracker/Track-php-OcMaOirM/" target="_blank"><B>How to replace a backslash character in a string?</B></A></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Expanded incorporation of Facebook Connect</title>
		<link>http://www.kevinpajak.com/blog/2010/02/12/expanded-incorporation-of-facebook-connect/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/12/expanded-incorporation-of-facebook-connect/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:13:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[To-Do]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=360</guid>
		<description><![CDATA[ON THE DOCKET: Expanded incorporation of Facebook Connect via external sites to boost online community involvement and social media marketing exposure (oh, and perhaps even MORE importantly, to play around with the back-end code with apps baby! :p)]]></description>
			<content:encoded><![CDATA[<p>ON THE DOCKET: Expanded incorporation of Facebook Connect via external sites to boost online community involvement and social media marketing exposure (oh, and perhaps even MORE importantly, to play around with the back-end code with apps baby! <img src='http://www.kevinpajak.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  :p)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/12/expanded-incorporation-of-facebook-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqli_real_escape requires TWO parameters!</title>
		<link>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 08:27:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=356</guid>
		<description><![CDATA[Props to this really useful post on PHPFreaks.com: http://www.phpfreaks.com/forums/index.php?topic=219045.0 I was having some issues with a mysqli_real_escape_string function that I had converted from mysql to mysqli I believe that the mere mysql version of this tag can function with just a $value, but the mysqli version requires TWO PARAMETERS: both the $connection variable, and the [...]]]></description>
			<content:encoded><![CDATA[<p>Props to this really useful post on PHPFreaks.com:<br />
<A HREF="http://www.phpfreaks.com/forums/index.php?topic=219045.0" target="_blank">http://www.phpfreaks.com/forums/index.php?topic=219045.0</A></p>
<p>I was having some issues with a mysqli_real_escape_string function that I had converted from mysql to <em>mysqli</em> I believe that the mere mysql version of this tag can function with just a <b>$value</b>, but the mysqli version requires TWO PARAMETERS: both the $connection variable, and the $string (whatever variable your particular function uses. The one I have here goes through all posts in a foreach statement and escapes the values of all posts using an array (to prevent MySQL injections).</p>
<p>Ex:<br />
  //This stops SQL Injection in POST vars<br />
  foreach ($_POST as $key =&gt; $value) {<br />
    $_POST[$key] = mysqli_real_escape_string($connection, $value);<br />
  }</p>
<p>$connection = whichever variable you would normally use to reference connection to your MySQL database(s).</p>
<p><A HREF="http://www.phpfreaks.com/forums/index.php?topic=219045.0" target="_blank"><B>THIS POST</B></A> solved my problem! (Thanks a lot Bendude14!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to log out a user who closes the browser window</title>
		<link>http://www.kevinpajak.com/blog/2010/02/10/how-to-log-out-a-user-who-closes-the-browser-window/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/10/how-to-log-out-a-user-who-closes-the-browser-window/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 04:43:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daily Journal]]></category>
		<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=339</guid>
		<description><![CDATA[I would like to thank Brazilian software developer Daniel Melo for posting this code which helped me to solve a problem which was very pesky indeed, and in need of a solution. The problem occurred during a user&#8217;s logged-in session for a chat application I was building. This was the issue: the app is basically [...]]]></description>
			<content:encoded><![CDATA[<p>I would like to thank Brazilian software developer Daniel Melo for posting this code which helped me to solve a problem which was very pesky indeed, and in need of a solution. The problem occurred during a user&#8217;s logged-in session for a chat application I was building. This was the issue: the app is basically a live-chat client, which also shows all current users online, by name. If a logged-in user clicked the &#8220;Logout&#8221; link, all was good, no problem, his/her name was removed from the list of currently logged-on users. However, if the person just suddenly decided to end the chat session by just closing the browser and hitting &#8216;X&#8217; (as I myself might do!), the user was still showing as currently online, and NOT logged out (obviously this is an annoying issue). <span id="more-339"></span>After searching far and wide for this on the Internet, I came across the brilliant code I found at the link below on stackoverflow.com:</p>
<p><A HREF="http://stackoverflow.com/questions/1371757/how-to-kill-a-application-session-when-a-browser-window-is-closed" target="_blank"><B>&#8220;How to kill an application session when a browser window is closed?&#8221;</B></A></p>
<p>This code uses jQuery/Ajax in an absolutely brilliant and straightforward way. Basically what the code does is automatically load the contents of your &#8220;logoff.php&#8221; page, using the JavaScript <b>window.onbeforeunload</b> function (which is something that executes upon a user&#8217;s exiting the browser, refreshing the page, or submitting a form). Probably the most brilliant thing about this script is that it still uses the <em>onbeforeunload</em> function, BUT (and this was why it was of so much particular use to me for my particular case), let&#8217;s say that your web app page is relying on a form processor page that is on an external page, and not on the same page. If the user in this kind of case enters in their chat text, and then hits the submit button (but still is currently ON the page and actively participating in the current chat session), the typical <em>onbeforeunload</em> function if called, would execute (so basically, in this case, this would amount to the user being logged off every time he/she hit the &#8220;Post Message&#8221; button, and not JUST when the user closed the browser window).</p>
<p>So what this very clever script does is execute the contents of the script on your &#8220;logoff.php&#8221; page <b>onbeforeunload</b>, BUT <u>excepts the following cases:</u> (so it won&#8217;t get called if the user does the following things, and will only log the user out when he/she closes the browser window):</p>
<p>- Hitting the Submit button;<br />
- Clicking a link.</p>
<p>[The "magical" thing I will add too, after thinking about it, is that your 'logout.php' web page does not even have to be currently loaded on the browser - after all, the browser is being closed, right? This script executes your code all at once - like I said, fantastic! One other slightly unfortunate thing I found too in my extensive testing was that: this script works fine in Firefox and IE (and worked in Google Chrome, <em>after</em> not working the first time, insanely enough, but did not work in Opera or Safari :S). My sort of work-around for this was to at least add in code to my log-in page that sets the user's status to offline right away, then online once they are logged on and enter the chatroom].</p>
<p>Anyway, hope what I said here makes sense and is not too muddled an explanation, and&#8230; here is the code!:</p>
<div style="background: #EAE3E3; padding: 10px; border: 1px solid #000;">
/*<br />
* autoLogoff.js<br />
*<br />
* Every valid navigation (form submit, click on links) should<br />
* set this variable to true.<br />
*<br />
* If it is left to false the page will try to invalidate the<br />
* session via an AJAX call<br />
*/<br />
var validNavigation = false;</p>
<p>/*<br />
* Invokes the servlet /endSession to invalidate the session.<br />
* No HTML output is returned<br />
*/<br />
function endSession() {<br />
   $.get(&quot;&lt;whatever url will end your session&gt;&quot;);<br />
}</p>
<p>function wireUpEvents() {</p>
<p>  /*<br />
  * For a list of events that triggers onbeforeunload on IE<br />
  * check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx<br />
  */<br />
  window.onbeforeunload = function() {<br />
      if (!validNavigation) {<br />
         endSession();<br />
      }<br />
  }</p>
<p>  // Attach the event click for all links in the page<br />
  $(&quot;a&quot;).bind(&quot;click&quot;, function() {<br />
     validNavigation = true;<br />
  });</p>
<p>  // Attach the event submit for all forms in the page<br />
  $(&quot;form&quot;).bind(&quot;submit&quot;, function() {<br />
     validNavigation = true;<br />
  });</p>
<p>}</p>
<p>// Wire up the events as soon as the DOM tree is ready<br />
$(document).ready(function() {<br />
    wireUpEvents();  <br />
});
</div>
<p>From there, you just need to save this text in a file called &#8216;autoLogoff.js&#8217;, and call it toward the top of your page with the following code:</p>
<p>&lt;script type=&quot;text/javascript&quot; src=&quot;js/autoLogoff.js&quot;&gt;&lt;/script&gt;</p>
<p>I am making this post because this information was REALLY hard to find when I was searching for it, in the hopes that it can help you out with a similar project!</p>
<p>Again, here is the original posting for more and complete information:</p>
<p><A HREF="http://stackoverflow.com/questions/1371757/how-to-kill-a-application-session-when-a-browser-window-is-closed" target="_blank"><B>&#8220;How to kill an application session when a browser window is closed?&#8221;</B></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/10/how-to-log-out-a-user-who-closes-the-browser-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

