The balances are normally attributed to a user_id that the user can login with and check their balance. When a user would like to deposit an address the website code would query the Bitcoin client through JSON command that will generate an address. The newly generated address will be attributed to the user_id as a deposit address. The user then sends the Bitcoins to the address, and the website will ping the Bitcoin client every so often to see if any new bitcoins have been received, If there are new bitcoins the information can be extract to that particular transaction information like "+1 Bitcoin deposited" type of information. You take that information and increase the users current balance value.
I'm working on a Bitcoin Development Kit library for PHP that facilitates all these kind of convinces, checking new balances is a planned feature
but I'm going to make it official and post it on the github "issues" page. (https://github.com/Xenland/Bitcoin-Development-Kit/issues/5)
Update: This feature of updating balances has been added to the to-do list instead
(
https://github.com/Xenland/Bitcoin-Development-Kit/wiki/%28%29-To-Do-Features-%28Notes-to-contributing-developers%29)