Yii Framework Forum: [Solved] changing session id and getting data - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Solved] changing session id and getting data Rate Topic: -----

#1 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 28 October 2010 - 12:29 PM

when i am setting session id i can't get that session data.

How to get session data when changing session id?



Yii::app()->session->setSessionID($_POST['sessionid']);

$session_data  = Yii::app()->session->itemAt ('session_key');


0

#2 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 29 October 2010 - 02:00 AM

View PostR.K., on 28 October 2010 - 12:29 PM, said:

when i am setting session id i can't get that session data.

How to get session data when changing session id?



Yii::app()->session->setSessionID($_POST['sessionid']);

$session_data  = Yii::app()->session->itemAt ('session_key');





i have figure out

$data = unserialize(Yii::app()->session->readSession($_POST['sessionid']));
....
Yii::app()->session->writeSession ($_POST['sessionid'], serialize($data));

0

#3 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 29 October 2010 - 02:35 AM

Why would you ever want to change the session id?
0

#4 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 29 October 2010 - 03:08 AM

View PostMike, on 29 October 2010 - 02:35 AM, said:

Why would you ever want to change the session id?


This is because swfupload. SWFupload lose session id. i need to pass information back to my base application in session.
0

#5 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 29 October 2010 - 05:16 AM

another way to change session id is

if ( ! Yii::app()->session->getIsStarted ()) {
    	Yii::app()->session->setSessionID($_POST['PHPSESSID']);
    	Yii::app()->session->open();
}


only need to set in config file

'session'=>array(
                	'class'=>'CHttpSession',
                 	'autoStart' => false,
            	),

0

#6 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 29 October 2010 - 05:29 AM

In entry-script you can simply do

if (isset($_POST['PHPSESSID']))
{
   $_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
}


Then the original session should continue.
1

#7 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 29 October 2010 - 05:42 AM

View PostY!!, on 29 October 2010 - 05:29 AM, said:

In entry-script you can simply do

if (isset($_POST['PHPSESSID']))
{
   $_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
}


Then the original session should continue.


yes it is more simplified thank you :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users