Why did my iphone randomly turn off?

My iphone was working fine and i was charging it but then it turns off and the apple logo turns into a skull and it turned back on but when i put it to charge it just shut off and will not turn back on no matter how hard i try to turn it on and its iphone 3gs

Added (1). I was texting and listening to music does that count as overworking it?

You probably overworked it. (Doing many things at one time, apps in the backround, ect).

I don't know?

They hacked your mainframe using a GUI interface created in visual basic. There's no hope now. You might want to leave the country for a couple of years, just to be safe. What you've experienced is a well-known cyber attack.