This popup you say is because they used the javascript SDK to log in with Facebook, not PHP, which is your case.
In your case you can do the following, in the method FacebookRedirectLoginHelper you pass the same URL of the login page and in it you check if the user is coming from a Facebook login as well if it is already logged in.
For example, in FacebookRedirectLoginHelper an index.php would look like:
$helper = new FacebookRedirectLoginHelper('http://seusite/index.php');
...
and right there to receive / check the user back from the Facebook login page:
if ( !empty($_GET['code']) ){
...
$helper = new FacebookRedirectLoginHelper('http://seusite/index.php');
try {
$session = $helper->getSessionFromRedirect();
} catch
...
- When Facebook returns from login it brings this variable GET
Ps .: Logging into Facebook using the javascript SDK is extremely productive when possible.