has you have many times 'User' in login function, very hard to find
out which line.
However  'User' is not equal to 'user' in :

              $this->Session->write('last_login',$results['user']
['last_login']);


On Jun 28, 12:27 pm, "yudhi prasetyo" <[EMAIL PROTECTED]> wrote:
> hello All i'm newbie in cake world =),
> i've trouble when i learn some tutorial from ibm (cook up web fast
> using cakephp part2)
>
> /--template-- (index.thtml)/
>
> <p>Hello,<?e($User)['first_name'].''.$User['last_name'])?></p>
> <p>your last login was on <?e($last_login)?>
>
> <?echo $html->link('knownusers','/users/knownusers')?><?echo
> $html->link('logout','users/logout')?>
>
> /-- in mine controller--(users_controller.php)/
> function login()
> {
> $this->set('error',false);
> if($this->data)
> {
> $results=$this->User->findByUsername($this->data['User']['username']);
> if($results && 
> $results['User']['password']==md5($this->data['User']['password']))
>         {
>                 $this->Session->write('user',$this->data['User']['username']);
>                 
> $this->Session->write('last_login',$results['user']['last_login']);
>                 $results['User']['last_login'] = date("Y-m-d H:i:s");
>                 $this->User->save($results);
>                 $this->redirect('/users/index');
>                 }else
>                    {
>                      $this->set('error',true);
>                    }
>         }
>
> }
>
> function index()
> {
> $username=$this->Session->read('user');
> if($username)
>         {
>                 $username=$this->User->findByUsername($username);
>                 $this->set('User',$results['User']);
>                 $this->set('last_login',$this->Session->read('last_login'));
>         }else{
>                 $this->redirect('/users/login');
>                }
>
> }
>
> the trouble is when i execute,i've got error message like this;
> "Notice: Undefined index: User in
> C:\xampp\htdocs\kerjaan\cake\latianbake\controllers\users_controller.php
> on line 43"
>
> line 43 is in function login
>
> anyone can help me please ?
>
> thx before =)
>
> --
> -yprs-


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to