cfinger Posted August 1, 2007 Share Posted August 1, 2007 I'm working on a facebook app, and I can't for the life of me figure this one out. I need to create a session to pass some variables between pages. It works just fine when I run the page on my site, however when I try to view it on the facebook site, the session never carries over. POSTing stuff works just fine. At first session_start(); was all i needed, but I read that facebook had problems with carrying over sessions, so I'm using the code from here: http://wiki.developers.facebook.com/index.php/PHP_Sessions require_once 'appinclude.php'; ini_set("session.save_path", "/home/ckf/phpsessions/"); //*********************************** // Create Session Using Facebook Params //*********************************** $API_KEY = 'my key is in here'; $prefix = ($_REQUEST['fb_sig_user']) ? 'fb_sig' : $API_KEY; if( isset($_REQUEST[$prefix.'_session_key']) ){ session_name( $_REQUEST[$prefix.'_session_key'] ); session_start(); $_SESSION['fb_user'] = $_REQUEST[$prefix.'_user']; $_SESSION['fb_session_key'] = $_REQUEST[$prefix.'_session_key']; $_SESSION['fb_expires'] = $_REQUEST[$prefix.'_expires']; $_SESSION['fb_in_canvas'] = $_REQUEST[$prefix.'_in_canvas']; $_SESSION['fb_time'] = $_REQUEST[$prefix.'_time']; $_SESSION['fb_profile_update_time'] = $_REQUEST[$prefix.'_profile_update_time']; $_SESSION['fb_api_key'] = $_REQUEST[$prefix.'_api_key']; } else { // Just so there *is* a session for times when there is no fb session session_start(); } and I have the same in the pages where I POST information to. Any Ideas? Colin Quote Link to comment https://forums.phpfreaks.com/topic/62867-facebook-php-session-problem/ Share on other sites More sharing options...
cfinger Posted August 1, 2007 Author Share Posted August 1, 2007 strangely enough, everything works when I use an 'iframe'. There must be something that the 'fbml' doesn't like. Quote Link to comment https://forums.phpfreaks.com/topic/62867-facebook-php-session-problem/#findComment-312956 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.