<?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>HitSend Inc.</title>
	<atom:link href="http://hitsend.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://hitsend.ca</link>
	<description>Idea Management Made Easy!</description>
	<lastBuildDate>Tue, 29 Jan 2013 16:53:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>QR Codes are just the start&#8230;</title>
		<link>http://hitsend.ca/2011/07/05/qr-codes-are-just-the-start/</link>
		<comments>http://hitsend.ca/2011/07/05/qr-codes-are-just-the-start/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 22:12:01 +0000</pubDate>
		<dc:creator>Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=373</guid>
		<description><![CDATA[Here is a super cool video (retweeted by kevinrose) of a retailer in Korea using QR codes in a very clever way. The gist of the video is that people in Korea are very busy, work hard, and don&#8217;t have a lot of time to go grocery shopping.  What Homeplus (formerly Tesco) is doing is [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://hitsend.ca/wp-content/uploads/2011/07/blogQRcodeKorea.jpeg"><img class="alignleft size-full wp-image-374" title="blogQRcodeKorea" src="http://hitsend.ca/wp-content/uploads/2011/07/blogQRcodeKorea.jpeg" alt="" width="269" height="187" /></a>Here is a <a href="http://www.youtube.com/watch?v=nJVoYsBym88&amp;feature=player_embedded" target="_blank">super cool video</a> (retweeted by <a href="http://twitter.com/#!/kevinrose" target="_blank">kevinrose</a>) of a retailer in Korea using QR codes in a very clever way.</p>
<p>The gist of the video is that people in Korea are very busy, work hard, and don&#8217;t have a lot of time to go grocery shopping.  What Homeplus (formerly Tesco) is doing is bringing the grocery shopping experience to places like subway stations so that commuters can stock their cupboards while they wait for their commuter trains.  All of this is accomplished courtesy of some giant billboard posters that are scale representations of grocery aisles,  complete with QR codes under each product for easy ordering.</p>
<p>Why is this so clever?  Because what Homeplus has done is to take online behaviour and marry it to something physical: in this case, scanning a QR code leads to fresh produce being delivered.  I think that if you really want to engage people online, there needs to be some real-world affects of that online behaviour.  Technology is all fine and great, but people still live at least some of their lives offline.  Rewarding online behaviour with strictly online rewards is one thing, but if you can reward online behaviour with something real&#8230;well, now we&#8217;re getting somewhere.</p>
<p>Like the <a href="http://en.wikipedia.org/wiki/Kinect" target="_blank">Kinect</a>, I think the real power of QR codes is only just being tapped.  It&#8217;s going to be really cool to see what people start to do with this technology in the months (and weeks) to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2011/07/05/qr-codes-are-just-the-start/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>“Fashion is morphing into a two-way dialogue”</title>
		<link>http://hitsend.ca/2011/06/20/%e2%80%9cfashion-is-morphing-into-a-two-way-dialogue%e2%80%9d/</link>
		<comments>http://hitsend.ca/2011/06/20/%e2%80%9cfashion-is-morphing-into-a-two-way-dialogue%e2%80%9d/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 15:24:59 +0000</pubDate>
		<dc:creator>Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=367</guid>
		<description><![CDATA[Do you hear that?  That&#8217;s the sound of people catching on&#8230; Here is a great article by Lauren Indvik about how the Fashion industry is leveraging the power of crowdsourcing to directly engage their customers. It makes sense: if you make and sell clothing, which is primarily bought more as a want than a need, wouldn&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://hitsend.ca/wp-content/uploads/2011/06/Mugatu21.jpeg"><img class="alignleft size-full wp-image-370" title="Mugatu2" src="http://hitsend.ca/wp-content/uploads/2011/06/Mugatu21.jpeg" alt="" width="278" height="181" /></a>Do you hear that?  That&#8217;s the sound of people catching on&#8230;</p>
<p><a href="http://on.mash.to/kLed0j" target="_blank">Here</a> is a great article by <a title="Posts by Lauren Indvik" rel="author" href="http://mashable.com/author/lauren-indvik/">Lauren Indvik</a> about how the Fashion industry is leveraging the power of crowdsourcing to directly engage their customers.</p>
<p>It makes sense: if you make and sell clothing, which is primarily bought more as a want than a need, wouldn&#8217;t you like to know if customers like something BEFORE you order thousands of units?  Why not just let your customers tell you what to order instead of guessing on their behalf?  That way clothing providers can operate more efficiently while consumers can have more influence on the clothing they consume.  Simple, right?</p>
<p>Now sit back, and watch more and more designers follow suit.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2011/06/20/%e2%80%9cfashion-is-morphing-into-a-two-way-dialogue%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iceland leads&#8230;will we follow?</title>
		<link>http://hitsend.ca/2011/06/13/iceland-leads-will-we-follow/</link>
		<comments>http://hitsend.ca/2011/06/13/iceland-leads-will-we-follow/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 15:56:46 +0000</pubDate>
		<dc:creator>Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=351</guid>
		<description><![CDATA[Iceland is cool. They just get it. We just came across this great article by Sarah Kessler about how they are using social media to crowdsource their constitution. http://spbx.ca/sx On one hand, that&#8217;s awesome. On the other hand, why WOULDN&#8217;T you crowdsource your constitution? It&#8217;s 2011. We have the technology. Now we just need our [...]]]></description>
				<content:encoded><![CDATA[<p>Iceland is cool.  They just get it.  We just came across this great article by <a href="http://mashable.com/author/sarah-kessler/">Sarah Kessler</a> about how they are using social media to crowdsource their constitution.  <a href="http://spbx.ca/sx">http://spbx.ca/sx</a></p>
<p>On one hand, that&#8217;s awesome.  On the other hand, why WOULDN&#8217;T you crowdsource your constitution?</p>
<p>It&#8217;s 2011.  We have the technology.  Now we just need our leaders to be brave enough to listen to what the people have to say.</p>
<p>First Bjork, then Sigur Ros, and now a great example of how leaders can promote an active and engaged citizenship.   Thanks, Iceland.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2011/06/13/iceland-leads-will-we-follow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big Congrats to our Zone-mates 500px !!</title>
		<link>http://hitsend.ca/2011/06/08/big-congrats-to-our-zone-mates-500px/</link>
		<comments>http://hitsend.ca/2011/06/08/big-congrats-to-our-zone-mates-500px/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 14:44:22 +0000</pubDate>
		<dc:creator>Warren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=342</guid>
		<description><![CDATA[We would just like to share the good news (though you&#8217;ve probably already heard), 500px has recently raised their first round of funding. They are so hot right now. Like Hansel. Here&#8217;s what TechCrunch had to say: http://techcrunch.com/2011/06/03/white-hot-flickr-alternative-500px-raises-525k-in-series-a/ So huge congrats to the 500px team. Here is a pic of some of the celebrations we [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_349" class="wp-caption alignleft" style="width: 310px"><a href="http://hitsend.ca/wp-content/uploads/2011/06/500pxCake2.jpg"><img class="size-medium wp-image-349" title="500pxCake2" src="http://hitsend.ca/wp-content/uploads/2011/06/500pxCake2-300x199.jpg" alt="" width="300" height="199" /></a><p class="wp-caption-text">500px raises some serious cake.</p></div>
<p>We would just like to share the good news (though you&#8217;ve probably already heard), 500px has recently raised their first round of funding.  They are so hot right now.  Like Hansel.</p>
<p>Here&#8217;s what TechCrunch had to say:<br />
<a href="http://techcrunch.com/2011/06/03/white-hot-flickr-alternative-500px-raises-525k-in-series-a/"> http://techcrunch.com/2011/06/03/white-hot-flickr-alternative-500px-raises-525k-in-series-a/</a></p>
<p>So huge congrats to the 500px team.  Here is a pic of some of the celebrations we had in the DMZ yesterday.  Mmmm carrot cake&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2011/06/08/big-congrats-to-our-zone-mates-500px/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ryerson Eyeopener shouts about SoapBox.</title>
		<link>http://hitsend.ca/2010/10/07/ryerson-eyeopener-shouts-about-soapbox/</link>
		<comments>http://hitsend.ca/2010/10/07/ryerson-eyeopener-shouts-about-soapbox/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 18:56:44 +0000</pubDate>
		<dc:creator>Brennan McEachran</dc:creator>
				<category><![CDATA[Media Hits]]></category>
		<category><![CDATA[Ayu]]></category>
		<category><![CDATA[Blackboard]]></category>
		<category><![CDATA[Braga]]></category>
		<category><![CDATA[Brennan]]></category>
		<category><![CDATA[Fall]]></category>
		<category><![CDATA[Graham]]></category>
		<category><![CDATA[Matt]]></category>
		<category><![CDATA[Matther Braga]]></category>
		<category><![CDATA[McEachran]]></category>
		<category><![CDATA[Ryerson]]></category>
		<category><![CDATA[Soapbox]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=334</guid>
		<description><![CDATA[Can&#8217;t bring a SoapBox with you? Can&#8217;t take the heavy lifting? The Ryerson Blackboard is featuring an online SoapBox for you to share your ideas and concerns about Ryerson and the community. Matt Braga from the Eyeopener wrote a thorough article on the fantastic new feature being added to Ryerson&#8217;s Blackboard this Fall. Brennan explains [...]]]></description>
				<content:encoded><![CDATA[<p>Can&#8217;t bring a SoapBox with you? Can&#8217;t take the heavy lifting? The Ryerson Blackboard is featuring an online SoapBox for you to share your ideas and concerns about Ryerson and the community. Matt Braga from the Eyeopener wrote a thorough article on the fantastic new feature being added to Ryerson&#8217;s Blackboard this Fall. Brennan explains how a student will be able to access SoapBox through Blackboard.</p>
<p>Want more information? Click the link below:</p>
<p><a href="http://theeyeopener.com/2010/09/get-on-your-soapbox-and-shout-it/">http://theeyeopener.com/2010/09/get-on-your-soapbox-and-shout-it/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/07/ryerson-eyeopener-shouts-about-soapbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook Connect User Authentication using the new Graph API in CodeIgniter</title>
		<link>http://hitsend.ca/2010/10/05/facebook-connect-user-authentication-using-the-new-graph-api-in-codeigniter/</link>
		<comments>http://hitsend.ca/2010/10/05/facebook-connect-user-authentication-using-the-new-graph-api-in-codeigniter/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 18:48:54 +0000</pubDate>
		<dc:creator>Graham McCarthy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=171</guid>
		<description><![CDATA[The User Experience is a very important element of system design.  At HitSend Inc., we really try to make that experience easy and intuitive for our users. With this in mind, we knew our users would need to have user profiles to access our system.  However, we did not want to force them to create [...]]]></description>
				<content:encoded><![CDATA[<p>The User Experience is a very important element of system design.  At HitSend Inc., we really try to make that experience easy and intuitive for our users.</p>
<p>With this in mind, we knew our users would need to have user profiles to access our system.  However, we did not want to force them to create another username and password to remember.  So from the beginning we knew we wanted to capitalize on the robust authentication systems already created!</p>
<p>This tutorial will show how we use the new Facebook Connect Graph API to supplement our authentication system using the CodeIgniter PHP framework.</p>
<p>First, I want to thank <a href="http://www.haughin.com/code/facebook/">Elliot Haughin</a> for his work in creating a Facebook Connect CodeIgniter framework that helped get ours up and running fairly quickly. <em> (Actually, it is because of his that I have decided to release this to the wild, in the hopes that someone comes along and makes an even better one that I can use!)</em>.</p>
<p>To make this tutorial as simple as possible, I&#8217;ve assume that you have basic knowledge of the CodeIgniter framework and have looked into the Facebook API documentation (<em>&#8230; at least a little bit&#8230;</em>)<br />
<img class="aligncenter size-full wp-image-290" title="facebook-codeigniter" src="http://hitsend.ca/wp-content/uploads/2010/10/facebook-codeigniter1.png" alt="" width="499" height="77" /></p>
<div class="greyBorder">
<div class="whiteBorder" style="padding: 10px;"><a class="action1" title="Download" href="http://hitsend.ca/wp-content/uploads/2010/10/facebook_demo.zip">Download the Code</a> <a class="action2" title="Any Thoughts?" href="#comments">Questions?</a> <a class="action3" title="Follow us" href="http://twitter.com/hitsend">Follow us on Twitter</a></div>
</div>
<p><strong>Alright, let&#8217;s get down to business!</strong></p>
<p>This tutorial is split into a few parts:</p>
<ol>
<li><a href="#step1">A brief overview on creating a Facebook application</a></li>
<li><a href="#step2">A simple user table for your database</a></li>
<li><a href="#step3">Setting up the config parameters and creating a library</a></li>
<li><a href="#step4">Using the PHP and Javascript APIs with your login code.</a></li>
<li><a href="#step5">Download the Source</a></li>
</ol>
<p><strong><br />
</strong></p>
<h2><a name="step1"></a>1. Create a Facebook Application</h2>
<p>The first thing you need to do is create a Facebook application.  There are tons of tutorials out there for doing this, so I won&#8217;t belabour this section.  Facebook have a pretty decent walk through for creating an app <a href="http://developers.facebook.com/docs/guides/canvas/">here</a>.  Once you have created your app, make note of the <strong>api key</strong>,  <strong>secret key</strong> and the <strong>site url</strong>.  We will be using these later on in the tutorial.</p>
<p>Here is an image of what my application settings look like:</p>
<p><a rel="attachment wp-att-178" href="http://hitsend.ca/?attachment_id=178"><img class="size-large wp-image-178 alignnone" title="facebook_app_settings" src="http://hitsend.ca/wp-content/uploads/2010/10/facebookSettings-570x282.png" alt="" width="570" height="282" /></a></p>
<p>The <strong>Site URL</strong> is the root location of your site, and the <strong>Site Domain</strong> is (as you would think) the domain of your site.  When setting up the application using the app id and secret key from a domain different from one you specified in the Site Domain field will cause an error.  So make sure this part is set up right before you continue.</p>
<p>Moving on&#8230;</p>
<h2><a name="step2"></a>2. Database schema</h2>
<p>Again, for simplicity sake, here is what our user table looks like.  In a real system we would capture a lot more information than this.</p>
<pre class="prettyprint lang-sql">CREATE TABLE user (
	user_id      VARCHAR(100),
	full_name  VARCHAR(100),
	pwd             VARCHAR(100),
	fb_uid        VARCHAR(100),
);</pre>
<p>The fields are pretty self explanatory.   The &#8216;user_id&#8217; is what the user would log in as.  The &#8216;pwd&#8217; field is the user&#8217;s password (ideally encrypted, to keep the data secure), the &#8216;full_name&#8217; is just another field you can capture.  You can add more fields to this table like,  email address, birthday, or whatever else you want to capture in your system.</p>
<p>The  &#8216;fb_uid&#8217; field will be the user&#8217;s Facebook account id that will be populated through Facebook, and is how we authenticate a person into our system through Facebook.</p>
<h2><a name="step3"></a>3. Creating the CodeIgniter facebook configuration and library</h2>
<p>The facebook configuration is used to store the users api key and secret key.</p>
<p>You will also need to create a file &#8216;<strong>facebook.php</strong>&#8216; in the &#8216;<strong>application/config/</strong>&#8216; folder.  It only contains the following 3 lines:</p>
<pre class="prettyprint lang-php">&lt;?php
$config['facebook_api_key'] = 'your_facebook_api_key';
$config['facebook_secret_key'] = 'your_facebook_secret_key';</pre>
<p>Creating a CodeIgniter library is the simplest way to integrate the Facebook Graph API into our system.</p>
<p>Download the latest PHP Facebook API from <a href="http://github.com/facebook/php-sdk/">http://github.com/facebook/php-sdk/</a> .  <em>All you really need from here is the facebook.php file. </em></p>
<p>Create a new directory called &#8216;<strong>facebook</strong>&#8216; under &#8216;<strong>application/libraries/&#8217;</strong> and place this<strong> facebook.php</strong> file here.</p>
<p>Now create a PHP file called &#8216;<strong>fb_connect.php</strong>&#8216; in the &#8216;<strong>application/libraries/</strong>&#8216;.</p>
<p>Below is the code for this PHP file: <em> (it is pretty simple, although it might be easier to read through the sample code.)</em></p>
<pre class="prettyprint lang-php">&lt;?php
//fb_connect.php
//Author: Graham McCarthy,  HitSend Inc., September 29th, 2010
//Email: graham@hitsend.ca
//Description: facebook connect library, connects to facebook and
//    stores all the required information in return variables
//grab the facebook api php file
include(APPPATH.'libraries/facebook/facebook.php');

class Fb_connect {
//declare variables
private $_obj;
private $_api_key        = NULL;
private $_secret_key    = NULL;

public     $user             = NULL;
public     $user_id         = FALSE;

public $fbLoginURL     = "";
public $fbLogoutURL = "";

public $fb             = FALSE;
public $fbSession    = FALSE;
public $appkey        = 0;

//constructor method.
function Fb_connect()
{
//Using the CodeIgniter object, rather than creating a copy of it
$this-&gt;_obj =&amp; get_instance();

//loading the config paramters for facebook (where we stored our Facebook API and SECRET keys
$this-&gt;_obj-&gt;load-&gt;config('facebook');
//make sure the session library is initiated. may have already done this in another method.
$this-&gt;_obj-&gt;load-&gt;library('session');

//
$this-&gt;_api_key        = $this-&gt;_obj-&gt;config-&gt;item('facebook_api_key');
$this-&gt;_secret_key    = $this-&gt;_obj-&gt;config-&gt;item('facebook_secret_key');

$this-&gt;appkey = $this-&gt;_api_key;

//connect to facebook
$this-&gt;fb = new Facebook(array(
'appId'  =&gt; $this-&gt;_api_key,
'secret' =&gt; $this-&gt;_secret_key,
'cookie' =&gt; true,
));

//store the return session from facebook
$this-&gt;fbSession  = $this-&gt;fb-&gt;getSession();

$me = null;
// If a valid fbSession is returned, try to get the user information contained within.
if ($this-&gt;fbSession) {
try {
//get information from the fb object
$uid = $this-&gt;fb-&gt;getUser();
$me = $this-&gt;fb-&gt;api('/me');

$this-&gt;user = $me;
$this-&gt;user_id = $uid;

} catch (FacebookApiException $e) {
error_log($e);
}
}

// login or logout url will be needed depending on current user state.
//(if using the javascript api as well, you may not need these.)
if ($me) {
$this-&gt;fbLogoutURL = $this-&gt;fb-&gt;getLogoutUrl();
} else {
$this-&gt;fbLoginURL = $this-&gt;fb-&gt;getLoginUrl();
}
} //end Fb_connect() function
} // end class</pre>
<h2><a name="step4"></a><strong>4. Setting up the Login</strong></h2>
<p>The reason for creating the library &#8216;fb_connect&#8217; is that whenever we want to access the facebook api, all we need to do in our controller is load the library:</p>
<pre class="prettyprint lang-php">$this-&gt;load-&gt;library('fb_connect');</pre>
<p>Then in our controller code we can make calls like:</p>
<pre class="prettyprint lang-php">$this-&gt;fb_connect-&gt;user_id; // returns the logged in users id
$this-&gt;fb_connect-&gt;user; // returns an object containing all the user data.</pre>
<p>You can also check if you have a valid and authenticated facebook session like this:</p>
<pre class="prettyprint lang-php">if($this-&gt;fb_connect-&gt;fbSession) {

// logged in just fine

} else  {

//Not Logged in

}</pre>
<p>The Login Controller and view can get a little messy.  I&#8217;ll assume you&#8217;ve already created a login that validates by using the user_id and pwd.  Again, there are plenty of tutorials around that cover this sort of interaction.  <a href="http://net.tutsplus.com/articles/news/codeigniter-from-scratch-day-6-login/">NetTuts have a very easy to follow tutorial</a>.</p>
<p>Logging in through Facebook skips this process.</p>
<p>It compares the item returned by $this-&gt;fb_connect-&gt;user_id to the fb_uid field in the user table.</p>
<p>Here is what a sample <strong>login.php</strong> controller looks like:</p>
<pre class="prettyprint lang-php">&lt;?php
class Login extends Controller {
function Login() {
parent::Controller();
$this-&gt;load-&gt;model('user_model');
}

function index() {
//create blank data array to return
$data = array();

$this-&gt;load-&gt;library('fb_connect');
$data = array(
'facebook'        =&gt; $this-&gt;fb_connect-&gt;fb,
'fbSession'        =&gt; $this-&gt;fb_connect-&gt;fbSession,
'user'            =&gt; $this-&gt;fb_connect-&gt;user,
'uid'            =&gt; $this-&gt;fb_connect-&gt;user_id,
'fbLogoutURL'    =&gt; $this-&gt;fb_connect-&gt;fbLogoutURL,
'fbLoginURL'    =&gt; $this-&gt;fb_connect-&gt;fbLoginURL,
'base_url'        =&gt; site_url('login/facebook'),
'appkey'        =&gt; $this-&gt;fb_connect-&gt;appkey,
);

$this-&gt;load-&gt;view('login_view', $data);
}

//This won't destroy your facebook session
function logout() {
$this-&gt;session-&gt;sess_destroy();
$data['logged_out'] = TRUE;
//$this-&gt;index($data);
redirect('/login/index');
} // function logout()

function _facebook_validate($uid = 0) {
//this query basically sees if the users facebook user id is associated with a user.
$bQry = $this-&gt;user_model-&gt;validate_user_facebook($uid);

if($bQry) { // if the user's credentials validated...
$data = array(
'user_id' =&gt; $uid,
'is_logged_in' =&gt; true,
'list_type' =&gt; 'hot'
);

$this-&gt;session-&gt;set_userdata($data);

$uri_var = $this-&gt;uri-&gt;segment(3);

if (strlen($uri_var) &gt; 0 ){
$url_location = $uri_var;
$url_location = str_replace('-', '/', $url_location);
redirect($url_location);
} else{
redirect('/message/index');
}

} else {
// incorrect username or password
$data = array();
$data["login_failed"] = TRUE;
$this-&gt;index($data);
}
}

function facebook() {
//1. Check to see if the facebook session has been declared
$this-&gt;load-&gt;library('fb_connect');

if(!$this-&gt;fb_connect-&gt;fbSession) {
//2. If No, bounce back to login
$this-&gt;index();
} else {

$fb_uid = $this-&gt;fb_connect-&gt;user_id;
$fb_usr = $this-&gt;fb_connect-&gt;user;

if($fb_uid != false) {
//3. If yes, see if the facebook id is associated with any existing account
$usr = $this-&gt;user_model-&gt;get_user_by_fb_uid($fb_uid);

if( is_array($usr) &amp;&amp; count($usr) == 1) {
$usr = $usr[0];
//3.a. if yes, log the person in
//echo "Logging in via facebook...";
$this-&gt;_facebook_validate($usr-&gt;user_id);

} else {
//3.b. if no, register the new user.
//echo "Creating a new account...";
//search for missing data and notify the user of what is missing.
$fname = $fb_usr["first_name"];
$lname = $fb_usr["last_name"];
$fullname = $fb_usr["name"];
$pwd = ''; //left blank so user can modify this later
$email = $fb_usr["email"];
//$fb_uid = already defined.

$db_values = array (
'user_id' =&gt; "fb:".$fb_uid,
'fb_uid' =&gt; "fb:".$fb_uid,
'full_name' =&gt; $fullname,
'pwd' =&gt; "",
);

//data ready, try to create the new user
if($query = $this-&gt;user_model-&gt;create_user($db_values) ) {
$data['account_created'] = true;
//log user in
$this-&gt;_facebook_validate($db_values["user_id"]);
} else {
//Did not work, go back to login page
$this-&gt;index();
}
}
}
}
}
}</pre>
<p>This controller includes a model called &#8216;<strong>user_model.php</strong>&#8216;.  Here is the code for that model:</p>
<pre class="prettyprint lang-php">&lt;?php
class User_model extends Model {
var $user_id = "";
var $full_name = "";
var $pwd = "";
var $fb_uid = "";

function User_model() {
//Call the Model constructor
parent::Model();

}

function validate_user_facebook($uid = 0) {
//confirm that facebook session data is still valid and matches
$this-&gt;load-&gt;library('fb_connect');

//see if the facebook session is valid and the user id in the sesison is equal to the user_id you want to validate
$session_uid = 'fb:' .  $this-&gt;fb_connect-&gt;fbSession['uid'];
if(!$this-&gt;fb_connect-&gt;fbSession || $session_uid != $uid ) {
return false;
}

//Receive Data
$this-&gt;user_id    = $uid;

//See if User exists
$this-&gt;db-&gt;where('user_id', $this-&gt;user_id);
$q = $this-&gt;db-&gt;get('users');

if($q-&gt;num_rows == 1) {
//yes, a user exists,
return true;
}

//no user exists
return false;
}

function create_user($db_values = '') {
$this-&gt;user_id       = $db_values["user_id"];
$this-&gt;full_name  = $db_values["full_name"];
$this-&gt;pwd           = md5($db_values["pwd"]);
if(strlen($db_values['fb_uid']) &gt; 0) {
$this-&gt;fb_uid        = $db_values['fb_uid'];
} else {
$this-&gt;fb_uid = "";
}

$new_user_data = array(
'user_id'  =&gt; $this-&gt;user_id,
'full_name'  =&gt; $this-&gt;full_name,
'pwd'      =&gt; $this-&gt;pwd,
'fb_uid' =&gt; $this-&gt;fb_uid,
);

$insert = $this-&gt;db-&gt;insert('users', $new_user_data);

return $insert;
}

function get_user_by_fb_uid($fb_uid = 0) {
//returns the facebook user as an array.
$sql = " SELECT * FROM SV_users WHERE 0 = 0 AND fb_uid = ?";
$usr_qry = $this-&gt;db-&gt;query($sql, array('fb:'.$fb_uid));

if($usr_qry-&gt;num_rows == 1) {
//yes, a user exists
return $usr_qry-&gt;result();
} else {
// no user exists
return false;
}
}
}</pre>
<p>The login.php controller links to a view called <strong>login_view.php</strong>.  Here is what it looks like:</p>
<pre class="prettyprint lang-html">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;title&gt;SoapBox Login&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- FB CODE --&gt;
&lt;div id="fb-root"&gt;&lt;/div&gt;
&lt;script type="text/javascript"&gt;
window.fbAsyncInit = function() {
FB.init({appId: '&lt;?=$appkey?&gt;', status: true, cookie: true, xfbml: true});

/* All the events registered */
FB.Event.subscribe('auth.login', function(response) {
// do something with response
login();
});

FB.Event.subscribe('auth.logout', function(response) {
// do something with response
logout();
});
};

(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());

function login(){
document.location.href = "&lt;?=$base_url?&gt;";
}

function logout(){
document.location.href = "&lt;?=$base_url?&gt;";
}
&lt;/script&gt;
&lt;!-- END OF FB CODE --&gt;

&lt;form action="&lt;?php echo site_url('login/validate_user/') . '/' . $uri_var;?&gt;" method="post"&gt;
&lt;p&gt;username:&lt;br /&gt;&lt;?= form_input('user_id', '') ?&gt;&lt;/p&gt;
&lt;p&gt;password:&lt;br /&gt;&lt;?= form_password('pwd', '') ?&gt;&lt;/p&gt;

&lt;p id="buttons"&gt;
&lt;fb:login-button onlogin="login();" size="medium" perms="email,offline_access,user_birthday,status_update,publish_stream"&gt;Connect&lt;/fb:login-button&gt;

&lt;?= form_submit('submit', 'Login') ?&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h2><a name="step5"></a>5. Download the Source</h2>
<p>It might be a little tricky copy and pasting the code in this tutorial.  So feel free to download the sample source.  It is fairly documented, and should show you how to integrate a login system with Facebook</p>
<div class="greyBorder">
<div class="whiteBorder" style="padding: 10px;"><a class="action1" title="Download" href="http://hitsend.ca/wp-content/uploads/2010/10/facebook_demo.zip">Download the Code</a> <a class="action2" title="Ask us in the Comments" href="#comments">Questions?</a> <a class="action3" title="Follow us" href="http://twitter.com/hitsend">Follow us on Twitter</a></div>
</div>
<p>If you have any questions or problems, or if you have a better way to integrate Facebook authentication in your system, please leave a comment!</p>
<p>Cheers,</p>
<p>Graham McCarthy.  HitSend Inc.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/05/facebook-connect-user-authentication-using-the-new-graph-api-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
		<item>
		<title>SoapBox is &#8220;creating the future!&#8221; &#8212; Huffington Post</title>
		<link>http://hitsend.ca/2010/10/05/soapbox-is-creating-the-future-huffinton-post/</link>
		<comments>http://hitsend.ca/2010/10/05/soapbox-is-creating-the-future-huffinton-post/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 18:47:47 +0000</pubDate>
		<dc:creator>Brennan McEachran</dc:creator>
				<category><![CDATA[Media Hits]]></category>
		<category><![CDATA[Ayu]]></category>
		<category><![CDATA[Brennan]]></category>
		<category><![CDATA[Graham]]></category>
		<category><![CDATA[HitSend]]></category>
		<category><![CDATA[Huffington Post]]></category>
		<category><![CDATA[Huffinton]]></category>
		<category><![CDATA[Julia Moulden]]></category>
		<category><![CDATA[love]]></category>
		<category><![CDATA[Paper]]></category>
		<category><![CDATA[Soapbox]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=332</guid>
		<description><![CDATA[SoapBox was written the topic of an article in the Huffington Post by Julia Moulden. The article is about the history behind SoapBox and everything there is to love about SoapBox, &#8220;Conversations happen. Stuff gets done. Students feel heard. What&#8217;s not to love?&#8221; A brief article, but it captures the essence of SoapBox well. Intrigued? [...]]]></description>
				<content:encoded><![CDATA[<p>SoapBox was written the topic of an article in the Huffington Post by Julia Moulden. The article is about the history behind SoapBox and everything there is to love about SoapBox, &#8220;Conversations happen. Stuff gets done. Students feel heard. What&#8217;s not to love?&#8221; A brief article, but it captures the essence of SoapBox well.</p>
<p>Intrigued? Read more by clicking the link below:</p>
<p><a href="http://www.huffingtonpost.com/julia-moulden/post_790_b_704555.html">http://www.huffingtonpost.com/julia-moulden/post_790_b_704555.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/05/soapbox-is-creating-the-future-huffinton-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you have a SoapBox? Ryerson does!</title>
		<link>http://hitsend.ca/2010/10/02/do-you-have-a-soapbox-ryerson-does/</link>
		<comments>http://hitsend.ca/2010/10/02/do-you-have-a-soapbox-ryerson-does/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 18:47:28 +0000</pubDate>
		<dc:creator>Brennan McEachran</dc:creator>
				<category><![CDATA[Media Hits]]></category>
		<category><![CDATA[DMZ]]></category>
		<category><![CDATA[Ryerson]]></category>
		<category><![CDATA[Soapbox]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[Zonene]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=330</guid>
		<description><![CDATA[The Ryerson Digital Media Zone is very proud of recent accomplishments from start-up companies within the Zone. SoapBox is one of the many being created in the Zone and featured within the article below! The article explains the functionalities of product SoapBox and how it will be effective within the Ryerson community. Interested? Click the [...]]]></description>
				<content:encoded><![CDATA[<p>The Ryerson Digital Media Zone is very proud of recent accomplishments from start-up companies within the Zone. SoapBox is one of the many being created in the Zone and featured within the article below! The article explains the functionalities of product SoapBox and how it will be effective within the Ryerson community.</p>
<p>Interested? Click the link below to read more on Burstn, Ryerson Mobile, and SoapBox:</p>
<p><a href="http://www.ryerson.ca/news/media/General_Public/20100826_mr_dmzbts.html">http://www.ryerson.ca/news/media/General_Public/20100826_mr_dmzbts.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/02/do-you-have-a-soapbox-ryerson-does/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Inspiration Article from the Northumberland News about Brennan&#8217;s Journey with HitSend Inc.</title>
		<link>http://hitsend.ca/2010/10/02/327/</link>
		<comments>http://hitsend.ca/2010/10/02/327/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 18:40:24 +0000</pubDate>
		<dc:creator>Brennan McEachran</dc:creator>
				<category><![CDATA[Media Hits]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[dreams]]></category>
		<category><![CDATA[HitSend]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[Northumberland]]></category>
		<category><![CDATA[Ryerson]]></category>
		<category><![CDATA[Soapbox]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=327</guid>
		<description><![CDATA[Moya Dillon wrote a stunning article in Northumberland News in August 2010 about HitSend Inc. and the product they have created called SoapBox. Brennan McEachran, CEO of HitSend, describes how many sleepless nights and a well-crafted email got the ball rolling to create change within Ryerson. Brennan also explains that he hopes SoapBox, in the [...]]]></description>
				<content:encoded><![CDATA[<p>Moya Dillon wrote a stunning article in Northumberland News in August 2010 about HitSend Inc. and the product they have created called SoapBox. Brennan McEachran, CEO of HitSend, describes how many sleepless nights and a well-crafted email got the ball rolling to create change within Ryerson. Brennan also explains that he hopes SoapBox, in the future, will be used by various other groups and organizations. Brennan&#8217;s biggest aspiration for SoapBox is for the government to begin using HitSend&#8217;s product, SoapBox.</p>
<p>Brennan shared how he stays inspired with Moya, &#8220;if it looks like a challenge, or like something I can&#8217;t do, then I have to do it. Or at least try.&#8221;</p>
<p>Click on the link below to see how Brennan was originally inspired to create SoapBox and his company HitSend:</p>
<p><a href="http://www.northumberlandnews.com/article/160097">http://www.northumberlandnews.com/article/160097</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/02/327/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HitSend Inc. Featured in Northumberland Today</title>
		<link>http://hitsend.ca/2010/10/02/hitsend-inc-featured-in-northumberland-today/</link>
		<comments>http://hitsend.ca/2010/10/02/hitsend-inc-featured-in-northumberland-today/#comments</comments>
		<pubDate>Sat, 02 Oct 2010 18:29:26 +0000</pubDate>
		<dc:creator>Brennan McEachran</dc:creator>
				<category><![CDATA[Media Hits]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[Brennan]]></category>
		<category><![CDATA[dreams]]></category>
		<category><![CDATA[frustration]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[HitSend]]></category>
		<category><![CDATA[Northumberland]]></category>
		<category><![CDATA[Soapbox]]></category>
		<category><![CDATA[stories]]></category>
		<category><![CDATA[story]]></category>

		<guid isPermaLink="false">http://hitsend.ca/?p=325</guid>
		<description><![CDATA[Cecilia Nasmith from Northumberland Today published an article about Brennan McEachran, CEO of HitSend Inc., focusing on the history of how HitSend Inc. and the idea of SoapBox were set into motion. The article talks about dreams that Brennan has for SoapBox and what frustrations it hopes to relieve for students. If you&#8217;re interested in [...]]]></description>
				<content:encoded><![CDATA[<p>Cecilia Nasmith from Northumberland Today published an article about Brennan McEachran, CEO of HitSend Inc., focusing on the history of how HitSend Inc. and the idea of SoapBox were set into motion. The article talks about dreams that Brennan has for SoapBox and what frustrations it hopes to relieve for students. If you&#8217;re interested in reading Cecilia Nasmith&#8217;s article from Northumberland Today please click the link below:</p>
<p><a href="http://www.northumberlandtoday.com/ArticleDisplay.aspx?e=2714259">http://www.northumberlandtoday.com/ArticleDisplay.aspx?e=2714259</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hitsend.ca/2010/10/02/hitsend-inc-featured-in-northumberland-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
