How to make a Refferal System? HELP!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make a Refferal System? HELP!

    Plis anyone help here and give me a example code script to create some link like this "/reg.php?refid=1,2,3,,,etc"
    I hope someone else here can help me!
    This my first code snippet but is not working, how to fix this?
    PHP Code:
    if (isset($_GET['refid']))
    {
    $refid mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1"));
    mysql_query("UPDATE `user` SET `idr` = '".($user['idr']+100)."' WHERE `id` = '$user[id]' LIMIT 1");

    Last edited by arnage; 31.07.12, 17:28.

    #2
    u have mixed $refid & $user.

    *this is a very basic ref code. u have to think more.

    Comment


      #3
      What are u mean friend?, please can u explain me more detail, can u give me a some example refferal code script here?

      Comment


        #4
        01. the bug of ur code is, u get query result to $refid. but u use $user in 2nd query.

        02. when u r using this code, if a visitor or ur user refreshed several times this url, what happen? ur user get more n more ref points?
        so use a cookie or a session record to name each visitor. then don't add ref points only for new visitors.
        if u r using this ref system for user registration site, just update ref points after registering a visitor.

        *we can suggest u, but can't code for u friend.

        Comment


          #5
          PHP Code:
          if (isset($_GET['refid']))
          {
             
             
          $refid =  intval($_GET['refid']);

             
          $query mysql_query("SELECT * FROM user WHERE id='".$refid."'");
             if(
          mysql_num_rows($query)>0)
             {
                
                
          //do the update here
                
          mysql_query("UPDATE user SET idr=idr+100 WHERE id='".$refid."'");

             }

          Comment


            #6
            Thank's my friend @Antonytx

            Comment


              #7
              hai bro.....I have posted a script for this before..Search in my posts I'm sure u could find it.

              or if I could find it, I will definetly post it here for you.


              I'm Proud to be a Sri Lankan!

              Comment

              Working...
              X