Why is my iPhone 4S turning on and off on itself?

Hi so my iPhone is glitching all over the place. For instance, when I try to type in my passcode, it just stays there and only shows the my wallpaper along with the keypad that you type your passcode with. I tried syncing it to the computer but it does the same thing over and over again, turning off and on without me touch it. Not even a little finger laid on it. It won't let me log into my phone only it freezes for about 7-10 seconds and turns off and turns off a second later after it turns off. I'm watching my phone right now and this has been happening since approx. 6:45. Can someone please help me? Thanks! Well appreciated if helped!

Added (1). I meant to say "a second later, after, it turns on"

I suggest you take it to technical support. I'm usually an "expert" in this area, but you should let the people from the support take care of it. Many people asked me for help with the iPhone, but I've never heard anything like this.

  • Why is my new iPhone 8 freezing the music on the lock screen and turning the volume up and down itself? When I'm listening to music and then click home to light up the screen to change a song or whatever the song will be almost over and it'll say it's at 0:30 seconds? And then when I go to Instagram it just turns the volume up and down without me pressing any volume buttons?
  • Why is my iPhone 5 turning off and not turning back on? This has happened twice now. My iPhone 5 has turned off in the middle of the night with a full charge and off the charger, and when I try to turn it back on it takes a couple tries. Has anybody experienced this?
  • Why does my iphone 4s keep turning itself off and on? My Iphone 4s(Jaill broken) wasn't showing the home screen wall paper so i thought it was one of the Cydia tweaks so i started deleting some of them made my iphone stuck, so i desided to turn it off and when i did it keeps turning it self on and off on and off… And i won't connect with my Computer and i'm not in America atm so there's no Apple store around can some one please help me?
  • Why does my iPhone 4 keep turning off and on by itself when its plugged in? I have an iPhone 4 and whenever I unplug it, it turns off. I can't get any source of signal, the Wi-Fi switch is greyed out, the date changed to December 31 and the time is an hour behind. The battery before I plugged it in was 20% its been 5 minutes and its up to 100%. Pretty weird.