Hello,
Basicly this works as follows:
1. You analyze the referrer ($SERVER['HTTP_REFERER']) which holds the URL of the site that referred your visitor (but beware that this variable may be optional - it is not mandatory by the HTTP specs, and browsers may hav it turned off)
2. Based on that you set up a cookie that gets sent to the browser with lifetime of, say, one week (so that you are honest with your afiiliates - the visitor may wish to think for some time after he has visited your site). Using cookie will assure that if he returns in a couple of days, he will still be identified as being referred by the affiliate.
3. At the moment of purchase you examine if the cookie is present and update your affiliate's account.
The problem is that user may have cookies also disabled, so while this method will work for 99%, there still may be failures present.
__________________
onPHP5.com -
PHP5: Articles, News, Tutorials, Interviews, Software and more