Best way to store referrer?

I have a site with thousands of users. Each user have an unique ID, that they can share with their friends, and in that way get referrals.

What would you recommend the best way to store the $_GET['referral']; from the URL?

Upvotes: 0

Views: 438

Answers (1)

George Cummins
George Cummins

Reputation: 28936

Unique referral IDs should be stored in a database.

For the duration of a user's session, you can store the ID in his session like this:

session_start();
$_SESSION['referral_id'] = $_GET['referral'];

Upvotes: 1

Related Questions