What potential security risks are associated with using $_GET to pass parameters in PHP?
Using $_GET to pass parameters in PHP can lead to security risks such as SQL injection and cross-site scripting attacks if the input is not properly sanitized. To prevent these risks, it is important to validate and sanitize user input before using it in your application.
// Sanitize input from $_GET before using it
$param = isset($_GET['param']) ? filter_var($_GET['param'], FILTER_SANITIZE_STRING) : '';
// Example of using the sanitized input
echo "Parameter: " . $param;