O'Reilly logo

PHP 5 Social Networking by Michael Peacock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Help! I've forgotten!

Some of our users will probably forget their login details, particularly if they haven't used our site for a while. If we don't have provisions for this, then we will lose users.

There are three types of reminder we should include:

  • Username reminder
  • Password reminder
  • Resend e-mail verification message

Let's look at implementing these features in our authentication controller.

Username

If the user forgets his/her username, they simply supply their e-mail address, and we e-mail them a reminder:

private function forgotUsername() { if( isset( $_POST['email'] ) && $_POST['email'] != '' ) { $e = $this->registry->getObject('db')->sanitizeData( $_ POST['email'] ); $sql = "SELECT * FROM users WHERE email='{$e}'"; $this->registry->getObject('db')->executeQuery( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required