Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
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/ind ... P_SessionsCode: Select all
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? Thanks.
Colin
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]