Skip to content

Instantly share code, notes, and snippets.

@derekaug
Last active December 22, 2015 00:48
Show Gist options
  • Save derekaug/6391676 to your computer and use it in GitHub Desktop.
Save derekaug/6391676 to your computer and use it in GitHub Desktop.
Workaround for third party cookies in Safari...
<?php
// Start Session Fix
session_start();
$page_url = "http://www.facebook.com/pages/For-Testing/49209188225?sk=app_166147000244773";
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
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment