From the course: PHP Tips, Tricks, and Techniques

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Block access to expired member

Block access to expired member

- [David] Hi, I'm David Powers and welcome to this week's edition of PHP Tips, Tricks, and Techniques. Designed to help you become a smarter, more productive PHP developer. In the previous two editions, we looked at using the PHP password hashing API which offers a more secure method of encrypting and verifying passwords. And setting a future date using PHP relative date strings. Both subjects are useful in their own right but they also act as a curtain raiser to this question from a member. How can I prevent access when a membership has expired? Several possible solutions spring to mind. You could simply delete the member's account from the database. Without a username and password, they could no longer log in. But that's not a good idea because you would lose all information about the member, making reinstatement a hassle if they decide to rejoin. To avoid losing the member's data, you could set an inactive flag in the database. Again, not a good idea because it involves manually…

Contents