Website got hacked :-(

Permalink
My first Concrete 5 websitehttp://www.networkwaterford.ie was working perfectly up until today. I tried to log on to the site & got this error:

Parse error: syntax error, unexpected T_STRING in /home/netwat5/public_html/index.php on line 3

I downloaded the index file to check & there was a line of code that wasn't supposed to be there. I re-uploaded the index file & followed the string of errors replacing every file that came up with the line above (or a variant of) until the site started working again.

Any hints on stopping sites getting hacked???

PassionForCreative
 
andrew replied on at Permalink Reply
andrew
I can browse and hit the "login" page.
PassionForCreative replied on at Permalink Reply
PassionForCreative
Thanks for the reply Andrew. I got it fixed but don't want it to happen again. Any tips on avoiding getting hacked.
andrew replied on at Permalink Reply
andrew
Somebody inserted some code into your index.php file? I talked to our webhost about that, and they say that's likely the result of a trojan or something similar installed on your box:

"In recent cases like this, typically what happens is someone logs into the FTP or cPanel account from an infected machine, and the login credentials are sent
to an attacker who logs in later and adds malicious code to various files."