Cakephp 1.3 Session Deleted On Chrome and IE fixed

After gooling for days I came up with solutions to take a look at the core of cakephp. Since the session works pretty well on cakephp 1.2.7, I decided to compare the two.


Cakephp1.2.7/cake/libs/session.php

	function __initSession() {
		$iniSet = function_exists('ini_set');

		if ($iniSet && env('HTTPS')) {
			ini_set('session.cookie_secure', 1);
		}

		switch ($this->security) {
			case 'high':
				$this->cookieLifeTime = 0;
				if ($iniSet) {
					ini_set('session.referer_check', $this->host);
				}
			break;
			case 'medium':
				$this->cookieLifeTime = 7 * 86400;
				if ($iniSet) {
					ini_set('session.referer_check', $this->host);
				}
			break;
			case 'low':
			default:
				$this->cookieLifeTime = 788940000;
			break;
		}

cakephp1.3/cake/libs/cake_session.php

	function __initSession() {
		$iniSet = function_exists('ini_set');
		if ($iniSet && env('HTTPS')) {
			ini_set('session.cookie_secure', 1);
		}
		if ($iniSet && ($this->security === 'high' || $this->security === 'medium')) {
			ini_set('session.referer_check', $this->host);
		}
		$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();

my version

	function __initSession() {
		$iniSet = function_exists('ini_set');
		if ($iniSet && env('HTTPS')) {
			ini_set('session.cookie_secure', 1);
		}
		if ($this->security === 'low' ){
		}
		else if ($iniSet && ($this->security === 'high' || $this->security === 'medium')) {
			ini_set('session.referer_check', $this->host);
			$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();
		}

If  you have a better solution rather than editing the codes of cakephp. Please let me know.

Tags:

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.