Track an affiliate if someone directly copy paste the link

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
kasim.badami
Forum Newbie
Posts: 4
Joined: Wed Mar 24, 2010 5:50 am

Track an affiliate if someone directly copy paste the link

Post by kasim.badami »

Hello,
i am developing a affiliate program in PHP. The problem is how to track an affiliate if someone directly copy paste the link.

Example :
if link for an affiliate is following
http://DSAdESdSDF23423423.affiliate.test.com/
which redirects to
http://test.com/myproduct.php

But in case the user don't purchase the product and leave for now and next time user directly copy paste the above link http://test.com/myproduct.php and purchases the product.

So what to do in this case, can anyone suggest me a solution.. it's urgent............ Please
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Track an affiliate if someone directly copy paste the li

Post by JakeJ »

The easiest way is to use a cookie. Of course if the user has cookies disabled or clears the cache before doing this, then you're out of luck, but most people don't do that, so you're probably in good shape.

You could also verify IP addresses and capture things like browser and OS info to make it more accurate but if you get someone from behind a large NAT'd single address that isn't going to work and you'll have to rely on the cookies.

There's no 100% guaranteed way of capturing all those people that do that, you just have to go with best effort. The only other way is to force people to log in but people just casually browsing aren't going to do that.
Post Reply