Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good day, Hope all is well?

I am building a website and I need a system where users can reference other users to the site to register using a unique link. When a user reference 10 successful registered user, they are entitled to an award.

Please what is the best way to achieve this, I have not tried my hands on anything cause am confused about it and I have searched the internet but miss what am looking for. Please help...


Thanks
Posted
Comments
Manfred Rudolf Bihy 9-Jul-13 7:29am    
Then you should state what exactly you are looking for. You said you miss something. Collect your requirements and start implementing them.

- So what is it you are missing?
- What problems do you see?
- Where are you stuck?
tarhex 9-Jul-13 7:31am    
I meant I couldn't get information on how to build a system like that.

1 solution

Suppose there are 2 tables. One for users and other for reference. User table has a unique primary key called user_id. Now a user registers in this site and the system assigns a unique user id to that user. Suppose it is 1 and username is demo. Now you need to create a page called referrer.php and put the id and username as encoded e.g. U8061IU9KDLP004RS (You can use any types of encoding as you like).

PHP
$encoded_referral_ID = base64_encode($id.$username);
?>


So that the new users referrer url is: http://www.example.com/referrer.php?ref_id=U8061IU9KDLP004RS

Now this url is being published in social media and other websites. And then a visitor clicks that link. So the next process is:

In referrer.php you need to get the id and decode it. Then check the id & username with your user table whether it is there and valid. If yes then insert a record into referral id and redirect the visitor to the register page. Make it sure to have a status field in referral table. At the time of first insert, set the status as 0. After the visitor completing the registration, set the status 1.

Hope that make you sense..

Rony
 
Share this answer
 
Comments
tarhex 9-Jul-13 8:07am    
Blimey, thanks bro. As easy as ABC.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900