开发者

Recognizing that a particular user arrive using a particular link throughout the user's session

I'm using php, trying to create a referral system that works like this: 1)User A signs up, and is given a referral link to the website (e.g. uluyu.com/userA) 2)User A then passes the link to his friends, who visits the site through that link. 3)When his friend User B visits uluyu.com/userA and signs up and/or buy our products, I want to reward User A with points. So far I can do this by entering User A as the 'referror' in the database under User B's account when User B signs up.

The 1st problem is that User B might not sign up right away after he clicks on the link. He might br开发者_Python百科owse the website before deciding to sign up. Is there a way to recognize that User B arrived through that link throughout his session as long as, and only when he keeps his browser on uluyu.com?

The 2nd problem I think has the same solution as the 1st problem. Say the next day, User C sends his referral link to user B (i.e. website.com/userC), and user B clicks on it to visit our website and buys a product, I want to reward User C, not User A. Is there a way to make the referral entry in the database active only for every session?

I am still trying to decipher this question thread as well, apologies if the answer is the same: Maintaining a Session throughout the day

Many thanks.

^_^ David


I think you don't need to deal with PHP sessions.

You can do it with basic GET requests based on your given URL, ex: website.com/?user_id=1337

if (isset($_GET['user_id'])) {
    $rewarded_user = $_GET['user_id'];
    //reward...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜