I have made a facebook application which when opened from apps.facebook.com/myapp
points perfectly to my domain's index.php and can be seen in the facebook app window , but problem occurs when i try to redirect it to my register page ,it gets redirected to my domain , i want all the pages to be viewed in facebook app window . tried to use fb:redirect sdk function but site says they are going to deprecate these codes.
<?php
if(preg_match('/apps.facebook.com/',$_SERVER[HTTP_REFERER])){
$app_id = '';
$api_key = '';
$app_secret = '';
$canvas_page = 'mydomain/index.php';
$auth_url = "http://www.facebook.com/dialog/oauth?client_id=".
$app_id."&redirect_uri=".urlencode($canvas_page)."&scope=email,user_birthday,user_interests,user_about_me";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload,'-_', '+/')), true);
if (empty($data["user_id"])){
echo("<script> top.location.href='".$auth_url ."'</script>");
}else{
$canvas_page="mydomain/register.php";
echo ("<script> top.location.href='".$auth_url."'</script>");
}
}else{
echo "No facebook";
}
?>
the code works perfectly up till echo("<script> top.location.href='" .$auth_url ."'</script>")
when $canvas_page
is the one set in facebook app dev form ; but gets redirected to some other page when $canvas_page
is changed to my register.php page . where am i going wrong ?
thanks in advance