From the course: PHP: Creating Secure Websites

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Validating input

Validating input - PHP Tutorial

From the course: PHP: Creating Secure Websites

Start my 1-month free trial

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