ARDUINO MEGA RANDOMLY RESTARTS

badly need help guys..
I am working on a security system project and I uploaded this sketch in my arduino mega, at first it worked out well but after few more trials the my security system randomly restarts after entering the password. Is there something wrong with the EEPROM of the arduino or the code?

the codes will follow...

the codes will follow...

Someday, I guess.

Is there something wrong with the EEPROM of the arduino or the code?

I'd vote on the code.

I'm guessing he's using c strings (as he should) and he's running off the end of char array, or doing something wrong regarding the null termination causing something else to run off the end of the unterminated string. Or if he's using Strings, he's concatenating recklessly and runs out of memory - Strings are bad, use strings.

The problem is 99.99% likely your code or your wiring (ie, you try to drive something that draws so much current that it pulls the supply below the BOD voltage, triggering a BOR) - but you haven't posted either of those, so we can't really tell you what's wrong!

I would bet that there is some hardware that is causing a power crash and reset. When an arduino has a memory hang, I doubt that there is anything that will normally cause it to actually reset.

Such as a relay powered from the same power supply as the Mega? With no freewheeling diode maybe?

badly need help guys..

No code, no schematic.

All you have in return is educated guesses. If you need help that badly you will need to try harder to give us enough information to help you.