I am working in an application which is using facebook connect to log in the users using their facebook account.
Everything works fine except in the following case:<
APPID, 'secret' => SECRET, 'fileUpload' => true ) );
// if we are being visited by someone trying to logout, lets me sure they get logged out!
if( isset( $_GET['logged_out'] ) ) {
setcookie( "PHPSESSID", "", (time()-3600) );
header( "location: " . URL );
exit();
}
// lets try to get the users id
$user_id = $facebook->getUser();
// try to get their access token
$access_token = $facebook->getAccessToken();
// if we have an id
if($user_id) {
// from the offset, we're good to go...
$logged_in = true;
echo "Logged in
";
$params = array( 'next' => URL . '?logged_out' );
$return .= '
logout';
}else{
// login man!
$login_url = $facebook->getLoginUrl(
array(
'scope' => 'read_stream, publish_stream, manage_pages, photo_upload',
'next' => URL . '?logged_in'
)
);
$return .= 'Please login.';
}
echo $return
?>