Here is some test code that I used to test cookies with.
<?php
class StudiesController extends AppController {
var $name = 'Studies';
function index() {
if ($this->Session->check('user_id')) {
echo $this->Cookie->read('password');
$this->Session->setFlash('You are logged in!');
}
}
function getstarted() {
$password = Security::generateAuthKey();
$this->Cookie->write('password', $password);
if ($this->Study->User->save(array('password' => $password))) {
$this->Session->write('user_id',
$this->Study->User->id);
}
//echo $this->Cookie->read('password');
$this->redirect('/studies');
}
}
?>
If I call the getstarted method first, after the redirect to the index
method I'm trying to read the cookie that I previously wrote and it's
not showing up. Any ideas why? I'm assuming I'm doing something
wrong.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---