Yii Framework Forum: Session create/modify - Yii Framework Forum

Jump to content

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

Session create/modify Rate Topic: -----

#1 User is offline   Speeedfire 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 192
  • Joined: 02-March 12

Posted 17 April 2012 - 09:45 AM

Hi, i use this method. If redirect another domain, the session is not modified, but i redirect one page, the session is modified.

if(isset($_GET['cat'])) {
	$id = $_GET['cat'];
	$url = Yii::app()->getBaseUrl(true);
	Yii::app()->session['cat'] = $id;
	//var_dump(Yii::app()->session['cat']); exit;
	if($url == 'http://example.com' && Yii::app()->session['cat'] == 1) {
		$this->redirect('http://example2.com'); //dont work
	}
	else {
		$this->redirect(Yii::app()->baseUrl.'/'); //work
	}
}

0

#2 User is offline   wisp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 192
  • Joined: 04-February 11

Posted 17 April 2012 - 10:01 AM

Try session_write_close() just before the redirect
0

#3 User is offline   Speeedfire 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 192
  • Joined: 02-March 12

Posted 17 April 2012 - 10:21 AM

View Postwisp, on 17 April 2012 - 10:01 AM, said:

Try session_write_close() just before the redirect



It's doesn't work. :(
When i redirect to another domain, the session variable is the before page variable.
0

#4 User is offline   Speeedfire 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 192
  • Joined: 02-March 12

Posted 17 April 2012 - 01:33 PM

I use the session->close and the session->closeSession-s, but dont work...

if(isset($_GET['cat'])) {
        $id = $_GET['cat'];
        $url = Yii::app()->getBaseUrl(true);
        Yii::app()->session['cat'] = $id;
        Yii::app()->session->close();
        if(Yii::app()->session->closeSession()) {
         if($url == 'http://example.com' && Yii::app()->session['cat'] == 1) {
                 $this->redirect('http://example2.com'); //dont work
         }
         else {
                 $this->redirect(Yii::app()->baseUrl.'/'); //work
         }
        }
}


The 2 domain is running in one yii app.
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