识别特定用户在整个用户会话中使用特定链接到达

发布于 2024-10-27 08:24:37 字数 639 浏览 2 评论 0原文

我正在使用 php,尝试创建一个像这样工作的推荐系统: 1)用户A注册,并获得网站的推荐链接(例如uluyu.com/userA) 2) 然后,用户 A 将链接传递给他的朋友,他们通过该链接访问该网站。 3)当他的朋友用户B访问uluyu.com/userA并注册和/或购买我们的产品时,我想用积分奖励用户A。到目前为止,我可以通过在用户 B 注册时在用户 B 的帐户下的数据库中输入用户 A 作为“referror”来完成此操作。

第一个问题是用户 B 在点击链接后可能不会立即注册。他可能会在决定注册之前浏览该网站。有没有办法识别用户 B 在整个会话期间通过该链接到达,并且只有当他将浏览器保持在 uluyu.com 上时?

我认为第二个问题与第一个问题的解决方案相同。假设第二天,用户C将他的推荐链接发送给用户B(即website.com/userC),用户B点击它访问我们的网站并购买产品,我想奖励用户C,而不是用户A。有没有办法使数据库中的推荐条目仅在每个会话中处于活动状态?

我仍在尝试破译这个问题线程,如果答案相同,我们深表歉意: 全天保持会话

非常感谢。

^_^ 大卫

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 browse 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌酱 2024-11-03 08:24:37

我认为你不需要处理 PHP 会话。

您可以根据给定的 URL 使用基本的 GET 请求来完成此操作,
例如:website.com/?user_id=1337

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

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...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文