I’m trying to use $_SESSION['Auth']['User']['id'] in beforefilter() function in app_controller.php. But I’m getting error message.
Error message is -> Undefined variable: _SESSION [APP\app_controller.php
Here is my app_controller file. thanks
`class AppController extends Controller {
var $components = array('Acl', 'Session', 'Auth');
....................................`
Use
$this->Auth->user('id'), not the$_SESSIONvariable.If you insist on reading from the session directly, use
$this->Session->read('Auth.User.id').$_SESSIONshould be accessible, but that depends on when the session gets started and whether you’re using PHP’s session management at all. Use Cake’s wrappers, they take care of those details.