How does the use of register_globals impact PHP scripts and what are the potential pitfalls associated with it?

When register_globals is enabled in PHP, it automatically creates global variables from form input, cookies, and server variables. This can lead to security vulnerabilities such as injection attacks and unintended variable overwriting. To mitigate these risks, it is recommended to disable register_globals in the php.ini configuration file.

// Disable register_globals in php.ini
register_globals = Off;