It's nearly impossible to "accidentally" erase all settings on an iPhone...the device actually requires a double verification in order to do that (and a password to be input if one was setup). I'm always curious when people say they accidentally erased everything, considering the process...
If the device is stuck on the apple logo, you will most likely need to restore the device in iTunes with it connected via USB cord. Hopefully you have a backup of the device or you'll be starting from scratch. Also, if you had the device unlocked by any method outside direct carrier unlock, you stand the chance of also returning the device to a locked state.