Fixed mysql_real_escape_string error and email validity checking

This fixes the issue where mysql_real_escape_string was being used before any db() call was made, causing the database to be called with whatever mysql_connect() returns.  Changed to mysqli_real_escape_string with db()->getLink() as its first argument.

Eregi is deprecated, so I changed it to filter_var($email, FILTER_VALIDATE_EMAIL).  From what I've tested, that should still work, but you might want to test it just to be 100% sure.

I also added .idea/ to .gitignore.