O'Reilly logo

PHP & MySQL: The Missing Manual by Brett McLaughlin

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

Chapter 12. Cookies, Sign-ins, and Ditching Crummy Pop-ups

Yes, it’s time to begin to wind down. You’ve gone from seeing PHP as some strange, cryptic set of angle brackets and dollar signs to building your own application, including integration with a MySQL database, authentication, redirection, and a pretty decent set of utility functions. And no, you’re probably not going to sell your mini-application with its Twitter and Facebook sign-up to Google for a billion dollars or anything. But you should have a pretty good idea of how to think in PHP, and how scripts are structured to solve problems.

But before you can go twist and bend this app and your new skills to your own purposes, there are still some lingering issues that need to be handled. A few of these are nice-to-haves, and some are downright necessities if you’re going to spend your career writing web applications.

Here are just a few things that your application needs to round out both the app and your skills:

  • A better login screen. Nobody likes a bland gray pop-up; they want a branded, styled login form.

  • Better messaging indicating whether a user is logged in or not.

  • A way to log out.

  • Two levels of authentication: one to get to the main application, and then admin-level authentication to get to a page like show_users.php and delete_user.php.

  • Some basic navigation—and that navigation should change based on a user’s login and the groups to which they belong.

These are almost all related to the idea of logging in, and that’s no accident. ...

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