This begs a much clearer explanation... what server-side scripting languages does your host support, that you are familiar with? And how are you planning to give the referring website credit?
... and look up their database tutorials (under "backend programming").
But at the least you should look up some references to document.referrer
Don't worry - take the tutorials. They are really very user-friendly, and you don't have to be a genius to use databases. If you want evidence, I'll send you my picture.