What are the potential security risks associated with having register_globals set to on in PHP scripts?

Having register_globals set to on in PHP scripts can lead to security risks such as variable injection attacks, where an attacker can manipulate variables in the script by passing them through the URL or forms. To mitigate this risk, it is recommended to turn off the register_globals directive in the php.ini file or use the $_GET, $_POST, and $_REQUEST superglobals to access user input securely.

// Set register_globals directive to off in php.ini file
// OR
// Access user input securely using superglobals
$variable = isset($_GET['variable']) ? $_GET['variable'] : '';