From the course: PHP: Creating Secure Websites

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Validating input

Validating input

- [Instructor] In this chapter, we will learn real-world techniques to secure the input to PHP and the output from PHP. We'll start by using PHP to validate that input data matches our expectations. This is about securing the data that comes into your website through expected pathways. It's a little bit like the security screening at an airport. We want to inspect what's coming in so we can stop problems before they get inside. To recognize bad data, we need to give some thought to what good data looks like. It will vary for every project that you work on. For example, imagine PHP code to create new user accounts. On one project, usernames might be 10 lowercase letters and numbers. On another project, usernames might be any valid email address. And on another project, usernames might have capital letters, dashes and underscores, but not numbers. For each project, for every data input, we need to determine…

Contents