What are the potential pitfalls of using $_REQUEST in PHP for handling user input?

Using $_REQUEST in PHP for handling user input can lead to security vulnerabilities such as injection attacks and cross-site scripting. It is recommended to use $_GET or $_POST specifically based on the type of request being made to avoid these pitfalls.

// Example of using $_POST instead of $_REQUEST to handle user input securely
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';