How to script multilevel referal page

Hello please i need a help on how to script a multilevel referal page. I want it to be that when a member (Eg. Mike) register, he is on level 1, when he refer someone(Eg. Nelson) he(Mike) should move to level 2 and Nelson in level 1. when Nelson refer another person(Eg. Clitton), Clitton should be in level one, Nelson should move to level 2 and Mike should move to level 3 automatically.

On your normal membership script, add a referral tag.
When the new member is accepted, increase the count for person in the referral tag.

That’s all there is to it.

On your normal membership script, add a referral tag.
When the new member is accepted, increase the count for person in the referral tag.

That’s all there is to it.