Oh I found the answer with Mike's help.
Should be rewritten to:
<?php
if ($error)
{
  e('Invalid Login.');
}
?>
 Please log in.
</p>
<?php echo $html->formTag('/users/login') ?>
<label>Username:</label>
<?php echo $html->inputTag('User/username', array()) ?>
<label>Password:</label>
<?php echo $html->passwordTag('User/password', array()) ?>
<?php echo $html->submitTag('login') ?>
</form>
<?php echo $html->link('register', '/users/register') ?>


Helpful to those who try to follow IBM's #2 tutorial.



On Oct 4, 6:45 pm, val <[EMAIL PROTECTED]> wrote:
> Thank you! Solved the problem!
>
> Another question from the code above-
>
> http://localhost/users/login
>
> gives this:
>
> Parse error: syntax error, unexpected ')', expecting '(' in /var/www/
> cake/app/views/users/login.thtml on line 11.
>
> The login.thtml was copied from IBM tutorial.
>
> I guessed that $html->anything should be changed to $html->anythingTag
> but this was a wrong guess.
>
> On Oct 4, 5:33 pm, José Lorenzo <[EMAIL PROTECTED]> wrote:
>
> > You have a whitespace at the end of the file. Erase it.
>
> > On Oct 4, 11:01 am, val <[EMAIL PROTECTED]> wrote:
>
> > > Instead redirecting, i get this.. Any Ideas?
>
> > > login.thml:
> > > <?php
> > > if ($error)
> > > {
> > >   e('Invalid Login.');}
>
> > > ?>
> > > <p>
> > >  Please log in.
> > > </p>
>
> > > <?php echo $html->form('/users/login') ?>
> > > <label>Username:</label>
> > > <?php echo $html->input('User/username', array) ?>
> > > <label>Password:</label>
> > > <?php echo $html->password('User/password', array) ?>
> > > <?php echo $html->submit('login') ?>
>
> > > </form>
> > > <?php echo $html->link('register', '/users/register') ?>
>
> > > users_controller.php:
> > > <?php
> > > class UsersController extends AppController
> > > {
> > >   function register()
> > >   {
> > >     $this->set('username_error', 'Username must be between 6 and 40
> > > characters.');
> > >     if (!empty($this->data))
> > >     {
> > >       if ($this->User->validates($this->data))
> > >       {
> > >                if ($this->User->findByUsername($this->data['User']
> > > ['username']))
> > >                {
> > >                  $this->User->invalidate('username');
> > >                  $this->set('username_error', 'User already exists.');
> > >                } else {
> > >                  $this->data['User']['password'] = 
> > > md5($this->data['User']['password']);
>
> > >           $this->User->save($this->data);
> > >           $this->Session->write('user', $this->data['User']
> > > ['username']);
> > >           $this->redirect('/users/index');
> > >         }
> > >       } else {
> > >         $this->validateErrors($this->User);
> > >       }
> > >     }
> > >   }
> > >   function knownusers()
> > >   {
> > >     $this->set('knownusers', $this->User->findAll(null, array('id',
> > > 'username',
> > > 'first_name', 'last_name', 'last_login'), 'id DESC'));
> > >   }
> > >   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 logout()
> > >   {
> > >     $this->Session->delete('user');
> > >     $this->redirect('/users/login');
> > >   }
> > >   function index()
> > >   {
> > >     $username = $this->Session->read('user');
> > >     if ($username)
> > >     {
> > >       $results = $this->User->findByUsername($username);
> > >       $this->set('User', $results['User']);
> > >       $this->set('last_login', $this->Session->read('last_login'));
> > >     } else {
> > >       $this->redirect('/users/login');
> > >     }
> > >   }}
>
> > > ?>


--~--~---------~--~----~------------~-------~--~----~
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