开发者

Make referral links [closed]

开发者 https://www.devze.com 2023-01-27 05:51 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_Python百科 Closed 12 years ago.

I want to create and track referral links such as

www.domain.com/?ref=switz

How would I go about doing this?


The data will be in $_GET['ref']. Track it however you like.


Create a database table of reference codes. Whenever someone wants to link to your site, create a new code in the database (probably with md5(uniqid())), and generate the HTML link for them with that code in it , like <a href="http://example.com/?ref=cda4eee3898f8275ef78a733a47b1191">Go to Example.com!</a>

When a person visits your site via that link, the uniq code will be in the URL (in this case $_GET['ref']), and you can read that and do whatever you want. To know who it was, just look up the code in the database.


From the example you've given, I assume www.domain.com is your website, and ?ref=switz is the referring website.

If so, you can get the value of ref using:

<?php
  $ref = $_GET['ref'];
?>
0

精彩评论

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