How can I manually link an affiliate with a signup?

It would be a great feature to provide a way to manually link an affiliate with a signup.

Many of my affiliates are non-technical and forget to correctly use the affiliate code. Then I get the person who signed-up wanting to give their referral the credit. I used to payout just once, so I could manually add credit on the affiliate management page.

However, I am now paying out ongoing so the manual approach of editing the account page every month would not be something I can consider.

I assume I could make the changes in the database. What are the tables that I would need to edit to connect a referrer to an account?