2011-07-29 8 views
0

내가 CakePHP를 가진 프로젝트를 시작하는 과정에서 나는 내가 로그인/사용자 필드가 포함 된 세션을 생성하여 다음에 로그인 프로세스에 대한 이해를 얻기 위해 노력하고 있어요 :CakePHP의 로그인 및 세션 관리

function login_php(){ 
    // -=> Retrieve form fields "u" and "p" (Username and password): 
    $a = $this->params['form']['u']; //email address. 
    $b = $this->params['form']['p']; //password. 

    // -=> Query Retrieve User, match email and password fields: 
    // -=> Make users data available in the view: 
    $this->set('users', $this->User->find('all', array('conditions' => array('User.email =' => $a , 'User.password =' => $b)))); 
} 

//Setting Session Variables: 
    $this -> Session -> write("name", $users['User']['fname'] . " " . $users['User']['lname']); 

    //Retrieving Session Variables: 
    echo $this -> Session -> read("name"); 

하지만 세션 변수를 설정의이 마지막 부분에 문제가 있어요 : 지금 세션에서 그들을 사용자 필드에서 세션 변수의 수를 생성하고 설정하려는이 시점에서

.

질문 :

사용자의 세션 변수를 어떻게 설정합니까?

어떤 도움 감사들

...

답변