I am building a facebook app currently it is in sandbox mode. My code :-
index.php
You can not display the login dialog within any kind of frames – that’s an anti-phishing measure, the user is supposed to be always able to verify that the login dialog they are shown is indeed from facebook.com, and not a fake loaded from any other site.
You have to redirect to it in the top window instance. This can not be done server-side, so you have to use JavaScript: