Posted By

Whiteagle on 08/22/12


Tagged

iframe session cookie safari set facebook problem


Versions (?)

Facebook Safari Session Problem - Safari Iframe Set Cookie


 / Published in: PHP
 

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

  1. <?php
  2. // Start Session Fix
  3. $page_url = "http://www.facebook.com/pages/.../...?sk=app_...";
  4. if (isset($_GET["start_session"]))
  5. die(header("Location:" . $page_url));
  6. $sid = session_id();
  7. if (!isset($_GET["sid"]))
  8. {
  9. if(isset($_POST["signed_request"]))
  10. $_SESSION["signed_request"] = $_POST["signed_request"];
  11. die(header("Location:?sid=" . $sid));
  12. }
  13. if (empty($sid) || $_GET["sid"] != $sid)
  14. die('<script>top.window.location="?start_session=true";</script>');
  15. // End Session Fix
  16. ?>

Report this snippet  

You need to login to post a comment.