Just had this same thing happen to a site I administrate for a friend, although the hack didn't actually work - the inserted php caused a syntax error so the whole site went down. Luckily this pinpointed where the code had been inserted so it wasn't too mystifying.
Do check your footer.php as...