First try writing a small php script: create temp.php in your 'DocumentRoot' Directory of your server (check httpd.conf for this path).
Save following code to temp.php: <?php if (isset($_SESSION['hello'])){ echo "Session Variable Hello is ".$_SESSION['hello']; } else{ $_SESSION['hello'] = 'LEMUNE'; } ?> Visit http://localhost/temp.php two times. For 1st time, it will be all blank. For 2nd time, if you see the printout- Session Variable.. then your session is working OK and then start debugging with CakePHP. If you don't see the printout on 2nd visit, then there is a problem with your sessions in php.ini file. Fix this and your problem will be solved. I had similar problem and after 2 days of rigirous debugging found that the problem was with php.ini configuration file. So make sure above code works then try debugging in CakePHP. Also, I recommend you update your core.php in App/Config so that it uses 'database' for saving sessions. Ketan :-) Lemune wrote: > Hello all, > I'm just begin using the cakephp. > I'm trying to store 3 variable in session, but only the first one > that can be read. > This is my code: > function log_in() > { > $this->set('error',false); > > if($this->data) > { > > $results=$this->Login->findByUsername($this->data['Login'] > ['username']); > if($results && $results['Login']['password'] == > md5($this- > >data['Login']['password'])) > { > > $this->Session->write('user',$this->data['Login']['username']); > > $this->Session->write('usertype',$this->data['Login'] > ['login_type_id']); > > $this->Session->write('user_id',$this->data['Login']['user_id']); > $level=$this->Session->read('usertype'); > if($level==1) > { > > $this->redirect('/administrators/index'); > exit(); > } > elseif ($level==2) > { > $this->redirect('/sales_records/index'); > exit(); > } > else > { > > $this->redirect('/company_records/index'); > exit(); > } > } else { > $this->set('error',true); > } > > } > > } > > If i read the $user variable it give me the correct answer, but if i > read the 2 and 3 variable ($usertype & $user_id) it didn't work. So my > program didn't redirect. > What's wrong? > I also try to change my code : > $level=$results['Login']['login_type_id']; > > and then i try to echo the session variable in the redirected view, it > just give me the first one. > > this is the controller code on redirected > function index() > { > > //$username= > //$level=$this->Session->read('usertype'); > $this->set('level',$this->Session->read('user')); > $this->set('User_Type',$this->Session->read('usertype')); > $this->set('User_Id',$this->Session->read('user_id')); > } > this is the code on index.thtml > <p>welcome > <?php > echo 'how do you do.'; > e($level); //for username > e($User_Type); //for usertype > e($User_Id); //for user id > ?></p> > <br> > <?php echo $html->link('logout','/login/logout') ?> > > and the result is: > > > CakePHP Rapid Development > > welcome how do you do.lemune > > logout --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---