Return to Snippet

Revision: 59185
at February 7, 2013 20:43 by Whiteagle


Updated Code
<?php
	// Start Session Fix
	session_start();
	$page_url = "http://www.facebook.com/pages/.../...?sk=app_...";
	if (isset($_GET["start_session"]))
	    die(header("Location:" . $page_url));
	$sid = session_id();
	if (!isset($_GET["sid"]))
	{
	    if(isset($_POST["signed_request"]))
	       $_SESSION["signed_request"] = $_POST["signed_request"];
	    die(header("Location:?sid=" . $sid));
	}
	if (empty($sid) || $_GET["sid"] != $sid)
	    die('<script>top.window.location="?start_session=true";</script>');
	// End Session Fix
?>

Revision: 59184
at August 22, 2012 19:56 by Whiteagle


Initial Code
<?php
    // START SAFARI SESSION FIX
    session_start();
    $page_url = "http://www.facebook.com/pages/......./....?sk=app_.....";
    if (isset($_GET["start_session"]))
        die(header("Location:" . $page_url));
    
    if (!isset($_GET["sid"]))
        die(header("Location:?sid=" . session_id()));
    $sid = session_id();
    if (empty($sid) || $_GET["sid"] != $sid):
?>
   <script>
        top.window.location="?start_session=true";
    </script>
<?php
    endif;
    // END SAFARI SESSION FIX
?>

Initial URL

                                

Initial Description
Add this code in the top of your index.php and set $page_url to your application final tab/app URL.

Initial Title
Facebook Safari Session Problem - Safari Iframe Set Cookie

Initial Tags
facebook

Initial Language
PHP