The way I have set it up is that when the user first visits the site, it will ask them to login with Facebook. It gets an access token and creates a session on my site.
If at any point the user logs out of facebook, say in another tab, the session will still exists within in my application.
The only way I can see to detect if the user is still logged into Facebook is re-requesting an access token as there doesnt seem to be a way to check if an existing access token is still valid.
I did try simply doing:
file_get_contents('https://graph.facebook.com/me?access_token=xxx')
but, since the token is no longer valid (as the user has logged out), file_get_contents returns an error, although, viewing this in the browser shows the oauth exception but im assuming file_get_contents is erroring because of the HTTP response code
You could do something like this I think: