Results 1 to 2 of 2

Thread: [help] Create a referral system?

  1. #1
    77
    posts
    Registered User

    [help] Create a referral system?

    Hi. I've created a sort of referral system on my website, where if you send someone to a specific link to sign up it gives you a point in a MYSQL table.

    Then when you go to a specific page it will show how many users you have referred to the website. On this page I need to create a script that will determine how many users you have signed up and from that give you a prize of some sort.
    So if you have signed up 1 user you get something and 5 users and 20 and so on.

    Im not sure how to go about this? I would really appreciate some help.

  2. #2
    tables...
    [users]
    user_id | user_referral_number | email | first_name | last_name | referral

    when a user signs up, they get a referral number assigned to them, the best way to do it is probably make their user_referral_number a md5 or some sort of encrypted version of their email, sha1 is very long. OR you could just generate random letters and numbers... whatever suits your fancy. Either way you go about it you should always be checking to make sure that each string is unique. If someone is referred by another person when they sign up that persons user_referal_number OR user_id (which is my preferred method) in the referral column. To check something like that would be really simple too

    PHP Code:
    $result mysql_query"SELECT referral FROM users WHERE referral = $userid);
    echo 
    mysql_num_rows$result ); 
    now this is assuming $userid is set to to read the user_id from some sort of $_POST, $_GET OR $_SESSION
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012