ErreUve, you're writing an array in session, I think you need to serialize
it (check the php functions serialize and unserialize).
On 6/8/07, ErreUve <[EMAIL PROTECTED]> wrote:
>
>
> Hello all,
>
> I had the same problem. And I try wthis this: I put the 'User' in the
> session and I read this at index.thml.
> I've a WAMP and my login controller is like yours:
>
> function login()
> {
> // If a user has submitted form data:
> if (!empty($this->data))
> {
> $someone =$this->User->findByid($this->data['User']['id']);
> if(!empty($someone['User']['password']) &&$someone['User']
> ['password'] == $this->data['User']['password'])
> {
> $this->Session->write('User', $someone['User']);
> $this->redirect('users');
> }
> // Else, they supplied incorrect data:
> else
> {
> // Remember the $error var in the view? Let's set that to
> true:
> $this->set('error', true);
> $this->redirect('users');
> }
> }
> }
>
> But the difference is in the index.thml (In Spanish, sorry)
> <h1>Bienvenid@ </h1>
> <?php
> if (!$log)
> {
> echo "Registrate si quieres guardar tu historial de
> ejercicios.
> Gratis y fácil.";
> }
> else
> {
> //I read the 'User', who has 4 variables: id, intentos, aciertos
> and
> fallos.
> $user=$session->read('User');
> echo $user['id']." has hecho ".$user['intentos']."
> ejercicios con ".
> $user['aciertos']." aciertos y ".$user['fallos']." fallos";
>
> }
> ?>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---