Absolutely don't go changing index.php unless you have a really good understanding of what you're doing. A much more correct place to include this code would be in a file over-riding the the init_customer_auth script in the includes/init_includes folder.