Hi

I'm struggling with sessions in cakephp 2.0.3.

In this testcase the counter should be incremented with each click on
the link.  The counter always remains 1.

// CONTROLLER
<?php
class Test01sController extends AppController {

   public $components = array('Session');

   function testsession() {
      $scounter = 1;
      if ($this->Session->check('scounter')) {
          $scounter = $this->Session->read('scounter');
          $scounter++;
      }
      $this->Session->write('scounter', $scounter);
      $this->set('scounter', $scounter);
    }
}


//MODEL
<?php
class Test01 extends AppModel {
   var $name = 'Test01';
   var $useTable = false;
}
?>


// VIEW
<?php
echo $scounter;
?>
<br/><a href="/test01s/testsession">testsession</a>


// CORE
Configure::write('Session', array(
    'defaults' => 'php',
    'cookie' => 'vportal',
    'ini' => array('session.gc_divisor' =>
1000,'session.cookie_httponly' => true),
    'timeout' => 4320  //3 days
));




I also dumped the $_SESSION array. This array is always empty.

Any help or hints are appreciated.

-- Andre




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to