>
> $dbuser = $this->User->findByUsername($this->data['User']
> ['username']);
>
>                                if (!empty($dbuser) &&
> ($dbuser['User']['password'] == sha1($this-
> >data['User']['password'])))
>

have you tried using auth?



2008/6/9 Arak Tai'Roth <[EMAIL PROTECTED]>:

>
> So. I have coded a login, using admin routing, to a backend
> administrative portion of my site. However when I actually login, all
> it shows is a blank page and it doesn't seem to be hitting my
> admin_index function in my controller. I was just wondering if anyone
> has any insight to this problem, I have already checked the debug and
> the error logs and nothing pops up about this issue. Here is the code
> that is affecting all of this.
>
> config.php
>     Configure::write('Routing.admin', 'admin');
>
> users_controller.php
>                function login()
>                {
>                        if (!empty($this->data))
>                        {
>                                $dbuser =
> $this->User->findByUsername($this->data['User']
> ['username']);
>
>                                if (!empty($dbuser) &&
> ($dbuser['User']['password'] == sha1($this-
> >data['User']['password'])))
>                                {
>                                        $this->Session->write('User',
> $dbuser);
>                                        $dbuser['User']['last_login'] =
> date("Y-m-d H:i:s");
>                                        $this->User->save($dbuser);
>
>                                        $this->Session->setFlash('You have
> successfully logged in.');
>
>                                        if ($dbuser['User']['type'] ==
> 'admin')
>                                        {
>
>  $this->redirect('/admin/news/index');
>                                        }
>                                        else
>                                        {
>                                                $this->redirect('/clients');
>                                        }
>
>                                        exit();
>                                }
>                                else
>                                {
>                                        $this->set('error', 'Either your
> username or password is
> incorrect.');
>                                }
>                        }
>                }
>
> news_controller.php
>                function admin_index()
>                {
>                        $dbnews = $this->News->find('all',
> array('order'=>array('id DESC'),
> 'limit'=>3));
>
>                        $this->set('dbnews', $dbnews);
>                }
>
> If you need more code just ask.
>
> >
>

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