trigger action when user account created or updated

Another,

I wanted to create and trigger a custom code (operation on db) when user account is created or updated.

The Drupal 6 default set of advance actions doesn't have what I need, so I will have to write one myself. But how do I go about it, more specifically where, in which file I have to write it?

Second thing is triggering. When I go to admin->build->triggers->users, all options say "No available actions for this trigger". How do I add an action to those triggers.