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

Get PHP & MySQL: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.