We help IT Professionals succeed at work.
Get Started

Unable to login new user

jharris133 asked
Last Modified: 2013-11-10
I'm getting stuck when trying to login a new user to my site.  I have successfully been able to create a new user in my MySQL db via a PHP enabled front-end, and then it emails the user their password and username.  When I go back to login though, it keeps telling me that the login details were invalid.  I'm following the examples in Practical Web 2.0 Apps with PHP, so this isn't original code and there seems to be a problem with the code here (not for the first time).

Below is the code where this error message is generated...

// verify username and password aren't blank

if (count($errors) == 0) {

                    // setup the authentication adapter
                    $adapter = new Zend_Auth_Adapter_DbTable($this->db,


                    // try and authenticate the user
                    $result = $auth->authenticate($adapter);
                    if ($result->isValid()) {
                        $user = new DatabaseObject_User($this->db);

                        // record login attempt

                        // create identity data and write it to session
                        $identity = $user->createAuthIdentity();

                        // send user to page they originally request

                    // record failed login attempt
                    $errors['username'] = 'Your login details were invalid';

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE