Oh, well it seems many people know how to do this already. Well for anyone who doesn't know how to restart in this situation;
1. Connect your iphone to the computer with itunes using the charger.
2. Hold down home button and lock button for at least until the apple logo shows up.
The lock code should work after this and you should be able to unlock the iphone. I am not sure how long this will last/work or if the iphone will freeze again. This is just an explanation for anyone who wants a temporary fix.
I have heard of other ways to fix it but I'm not sure which is best or what other solutions could do.
By the way, your storage and memory should still be there.
I hope the freezing is a problem that can be fixed, but for now these solutions should have to do.