A few security-related questions: how do I automate a web service as much as possible without storing private keys on server? I'm learning how to use bitcoind, and want to set up a side project that uses bitcoin to learn along the way. I'll be using the json-rpc with PHP on my server. I want to create a service that will receive bitcoins from users, and will eventually send those bitcoins either back to the users or to my own wallet.

In order to keep things secure, as soon as coins arrive at a user's unique address, I want to automatically forward them to another wallet that doesn't have the private keys on the server.

My questions are thus:


What's the easiest way to handle the bitcoins from an off-server wallet (on my computer or such), without doing absolutely everything by hand? Would it be possible to write a script that does everything I want it to do with the off-server coins, after prompting me for the private keys? For example, a database could hold all the bitcoin commands that would need to be run, but it would need by "OK" to run (requiring the keys). Would the keys be somehow visible if someone got access to the server?
If not the above method, how else can I automate the process as much as possible? The only thing I can think of currently is to do everything by hand: have a private wallet on my home computer, seeing what to do with bitcoins on various addresses, and manually sending them out using my home bitcoin client to the required addresses. This would be extremely tedious with a lot of users on the service. Surely there's a better, secure way?
I don't want to keep private keys on the server for two reasons: a) I don't know anything about server administrations or server security, as I'm just a developer, and b) as a result, I have a managed server (managed by the host), so they could get into the server at any time. I'm wondering, can anyone suggest how to get started in server administration and security so that I can take it into my own hands?


Thank you.

EDIT: To clarify, I mean handling transactions that are off of the server, not actually in "cold storage." The off-server wallet could be hosted on my personal computer--I just don't want it on the server, since it's more prone to attack.
Set up a cold storage machine, not connected to the internet but with boitcoin installed. Generate a bunch of addresses on the cold storage machine.

Using a USB drive, copy the addresses from the cold storage machine to the online system's database.  No need to do anything with the private keys.

When needed on the online system, just send to 1 of the addresses in the database.  This can be totally automated.  You don't need a private key to send to an address.