开发者

PHP session loses information

开发者 https://www.devze.com 2023-03-17 11:49 出处:网络
I am passing my session ID thru a flash file to a php file and I am capturing the session ID on the other side and replace the newly generated ID by th开发者_开发问答e old one.

I am passing my session ID thru a flash file to a php file and I am capturing the session ID on the other side and replace the newly generated ID by th开发者_开发问答e old one.

$SID = $_GET['mysession'];
session_id($SID);
session_start();

Unfortunately the session is now empty and I don't get why.

print_r($_SESSION); 

returns just a 1. All variables from the session are empty/do not exists.

Anyone an idea how to catch the data again?

PHP Version 5.2.6-1+lenny12 with Apache.

Thanks David


I think you need to use session_start(); before you set anything in the session.


use it like this,

session_start();
$SID = $_GET['mysession'];
session_id($SID);

This says, enable session handling on this page and starts a session. after that you are fetching your previous session id and then assigning the same session id to this session. Hope, it helps you.

0

精彩评论

暂无评论...
验证码 换一张
取 消