I have this code:
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxxxxxx',
'secret' => 'yyyyyyy',
'baseUrl' => 'http://xxx.yyy.zz/',
'appBaseUrl' => 'http://apps.facebook.com/xxxxxx/',
'fileUpload' => 'true',
));
$user = $facebook->getUser();
$params = array(
scope => 'publish_stream,user_photos',
redirect_uri => 'http://www.facebook.com/xxxxxx?sk=app_123456789'
);
if ($user){
....
}
$loginUrl = $facebook->getLoginUrl($params);
if ($user){
// nothing
}else{
echo "<script type=\"text/javascript\">top.location.href = \"".$loginUrl."\";</script>";
}
My problem is, that it gets into an endless loop… reloads the page over and over.
Can someone help me to fix this?
Thank you very much!
The problem was that the main logic was not int the index.php. After i put everything back into that, the redirection stopped.