title: facebook authentication / login trouble
body: <p>I have setup facebook authentication using php and it goes something like this
  first getting the authorization here :</p>
  
  <pre><code>https://graph.facebook.com/oauth/authorize?client_id=&lt;?= $facebook_app_id ?&gt;&amp;redirect_uri=http://www.example.com/facebook/oauth/&amp;scope=user_about_me,publish_stream
  </code></pre>
  
  <p>then getting the access Token here :</p>
  
  <pre><code>$url = "https://graph.facebook.com/oauth/access_token?client_id=".$facebook_app_id."&amp;redirect_uri=http://www.example.com/facebook/oauth/&amp;client_secret=".$facebook_secret."&amp;code=".$code;"
  
  function get_string_between($string, $start, $end){ 
      $string = " ".$string; 
      $ini = strpos($string,$start); 
      if ($ini == 0) return ""; 
      $ini += strlen($start); 
      $len = strpos($string,$end,$ini) - $ini; 
      return substr($string,$ini,$len); 
  } 
  
  
  $access_token = get_string_between(file_get_contents($url), "access_token=", "&amp;expires=");     
  </code></pre>
  
  <p>then getting user info :</p>
  
  <pre><code>$facebook_user = file_get_contents('https://graph.facebook.com/me?access_token='.$access_token);
  
  $facebook_id = json_decode($facebook_user)-&gt;id;
  $first_name = json_decode($facebook_user)-&gt;first_name;
  $last_name = json_decode($facebook_user)-&gt;last_name;
  </code></pre>
  
  <p>this is pretty ugly ( in my opinion ) but it works....how ever....the user is still not logged in...because i did not create or retrieve any session variables to confirm that the user is logged in to facebook...</p>
  
  <p>which means that after getting the authentication done the use still has to login ....</p>
  
  <p>first: is there a better way using php to do what i did above ? 
  second: how do i set/ get session variable / cookies that ensure that the user doesnt have to click login </p>
  
  <p>thanks for your help</p>