Remove code which has been commented out since 2010

This is in the git history in case anyone needs to refer to it.
Remove code which has been commented out since 2007

This is in the git history in case anyone needs to refer to it.
Remove more long commented-out code that uses non-parameterized SQL
WiP: replace uses of mysql_real_escape_string with parameterized SQL