Example of the enterprise input validation and sanitization
Throughout this book, we will build a secure design for an event ticketing system. Envision a software system that allows a box office or a website to sell tickets to a famous musical concert or theatre event. Table 3 is a simplified STRIDE model for our running ticketing example. Next, we will look at utilizing the PHP filter_var function and FILTER_VALIDATE_* constants to perform input validation for various fields. Here is a PHP code sample that utilizes the filter_var extension for validating fields such as First Name, Last Name, Phone Number, Email, and Address:
<?php
// Function to sanitize and validate input
function sanitize_input($input) {
    $input = trim($input);
    $input = stripslashes($input);
    $input = htmlspecialchars($input);
    return $input;
}
// Function to validate name
function validate_name($name) {
  ...