if $user is empty i want to redirect to authenticate page but i am seeing facebook logo and require click this logo else dont go to the authenticate page.
This is my redirect code:
if($user)
{
// code..
}
else
{
$url = 'https://www.facebook.com/dialog/oauth?client_id=258561857493875&redirect_uri=http://apps.facebook.com/gunlukburcpaylas/&scope=email,read_stream,publish_stream,offline_access,user_birthday';
header("location:".$url);
}
You can see from here my application.
(Sorry for my English. My first language is not English)
The Facebook API does not allow you to issue Redirect headers for the Authetication page. Heres the Authentication page I use, with the pieces relevant to only my page removed. If you put this code in, it will work, as I use it in production for my facebook application. It also implements CSRF protection.
EDIT: I removed the APP_SECRET, because I doubt you need it.