Unless you are prepared to spend a lot of time learning, writing code, throwing that code away and starting over again; for something like that you either want to locate some ready-made scripts that you can adapt to your use, or hire someone to do it for you. Most of your requirements are non-trivial, and if done poorly can introduce some serious security risks to your site.