What's the best way for a website to detect payments from green addresses? Does any proven third party code exist for this? 

Edit* 

To be more specific, what I haven't been able to find out is how to get the sender's bitcoin address when receiving a transaction. As far as I know, bitcoind doesn't have a command that shows the prev_out hash.
It is now possible to determine the list of addresses that sent a transaction using the raw transaction JSON-RPC API calls that were released with bitcoind and bitcoin-qt version 0.7. The pseudo-code to accomplish this is:

txid = &lt;relevant transaction id&gt;
addresses = []
raw_tx = decoderawtransaction(getrawtransaction(txid))
for(input in raw_tx['vin']) {
  input_raw_tx = decoderawtransaction(getrawtransaction(input['txid']))
  addresses.push(input_raw_tx['vout'][input['vout']]['scriptPubKey']['addresses'][0])
}


Once you have the list of sending addresses stored in the addresses array, you can compare these addresses to a list of pre-approved green addresses. In most cases, you should expect there to only be a single unique address in the addresses array.

In order to get a list of suitable green addresses, you could hard-code it into your application, or you could use a dynamic source, such as Deepbit's JSON feed. This feed however, is notably missing Mt. Gox's Green Address