CakePHP Drops Session Between Pages

I have an application with several regions and various inbound links. The premise, as before, is that in app_controller I pull out these inbound links and set them in the session.

So, I have a huge beforeFilter () in my app_controller that catches them and sets two variables in the session. View.region and Search.engine, no problem.

There is a problem that the session does not seem constant in page requests. So, for example, when going to / review / write (userReviews / add), the session that was established when the user came to the site should be available. Although it seems that he disappeared!

It seems that unless $ this-> params is explicitly found in the app_controller and the written session variable, it does not exist on other pages.

So far I tried, the exchange between saving the session in 'cake' and 'php' seems to exhibit the same behavior. I use "php" by default. My Session.timeout is '120', Session.checkAgent is False and Security.level is 'low'. All of which should give sufficient indulgence to the structure to allow the sessions to live most!

I am a little puzzled by why the session seems to be either recreated or muted when a new page is requested. I commented out the calls to requestAction () to make sure that this also doesn't confuse the session request object, which doesn't seem to matter.

Any help would be great, since I don’t need to re-encode the site to pass all the various variables through the parameters in the url, as it suck, and it worked before that, thus including $ this-> Session-> read (' Viewing.region ') in all my code!

+3
source share
7 answers

Try setting the security setting in the /app/config/core.php file to medium or low. This solved the session issue I had.

+1
source

I had a solution, or at least a job for me

Are you trying to move from control reviews action write to controller userReviews action add right ???

, userReviews - php "? > " "NO MORE SPACE"

SO,

line
999 //more code lines
1000 ?>
1001

line
999 //more code lines
1000 ?>

+1

, $this- > params app_controller , .

, . , - , ​​ ( ), , :

$this->Session->write('Viewing.region');

(.: http://book.cakephp.org/view/398/Methods)

, . /config db. , .

, Cake ?

0

, ? , , , , , , .

: php?

0

, , , ( - ) beforeFilter() parent beforeFilter() ?

...

0

. . , . , php . ? > .

0

CakePHP. , . , app/tmp ( ) 777.

0

Source: https://habr.com/ru/post/1726786/


All Articles