How to make:
1. referral system (php mysql); example: http://domain.com/?ref=123
2. 123 is taken from registered user
3. if visitor come without referrer, script will select (automatic random) from registered user
Please help me !
Thanks
Thanks very much !
I was modified the script;
<?php
function random_registered_user() {
include "conn.php";
$random = mysql_query("SELECT * FROM `user` order by rand() limit 1",$koneksi);
while($brs = mysql_fetch_array($random))
{
echo "$brs[0]";
}
}
//
$referral = (isset($_GET['ref'])) ? ($_GET['ref']) : (random_registered_user());
echo "$referral";
?>
but, I have problem with track referrer to others page.
so, if user come with referrer, all page on my site will tract that visitor come with the referrer
please tell me again about tracking referrer,
no matter it's use cookies or session
And if I type on browser: ?ref=999
the referrer is 999, though the 999 is not registered id.
how to fix this problem ?.
only registered id (user) will be track, and if visitor typed the unregistered (unknown) id (user), script will select radomly from registered id.
Thanks