Results 1 to 5 of 5

Thread: Make Referral Link Travel With Visitor

  1. #1
    Join Date
    Jan 2009
    Location
    Rockford, Il
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Exclamation Make Referral Link Travel With Visitor

    I have a referral program in place in my website.

    The code assigned for users is http://www.example.com/?r=example

    Or

    To refer others, use <b><? example.com; echo $url; ?>http://www.example.com/?r=<? echo $row["username"]; ?></b>
    <br>

    Problems: It only goes to the index (home) page, When a visitor clicks on the register.php (register, sign-up) button it doesn't auto fill the referral option, it leaves it blank which kills the referral possibility.

    If any other area of the site is explored, the referral link is closed (doesn't follow the visitor around the site) and like my problem above, it then is a blank input text area which will surely be left blank and will screw people out of their referrals.

    The code above is used to assign users their referral link via the members.php area.

    The following code is the one used for the register page (register.php):

    Referrer (If Any):<br>
    <input type="text" size="25" maxlength="15" name="referer" value="<? echo limpiare($_GET["r"]); ?>">

    This script has had lots of errors in it (purchased) and I have been able to fix most of them, but I'm stuck after trying to fix this for weeks, I'm seeking help.

    The menu.php file (all the clickable options: home, register, proof, scripts, ect..) is set up like this down the line of links:

    <a href=\"index.php\">Home</a>

    Thanks in advance, Please Help...
    Rob

  2. #2
    Join Date
    Dec 2008
    Location
    Fremont, CA
    Posts
    30
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Default

    I did not really understand the problem here, however i hope this helps.

    you can get the referer page from using and use that further manipulations.

    PHP Code:
    <?php 
    $referer 
    $_SERVER['HTTP_REFERER']; //returns the absolute url
    $refererFile basename($referer); //returns the filename. eg(index.php)
    ?>
    Rgds,
    Kris

  3. The Following User Says Thank You to l_kris06 For This Useful Post:

    OUT2WIN (01-05-2009)

  4. #3
    Join Date
    Jan 2009
    Location
    Rockford, Il
    Posts
    8
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply.

    My problem is that the only time someone will get a referral actually sign up under them, is to have then put in the username of the person who referred them in the provided text area.

    Each user is asigned a referral link (the same as 99% of most sites who do this) which is something like this:
    http://www.example.com/?r=out2win

    Then when they post it and a possible referral/visitor clicks on it, it should take them to the site, and travel along with them as they explore the site. Some sites have this feature so they can reap in referrals to sell and screw over members who are paying out of their pockets to advertise their site online. In my case, its just not routing correctly and I can't launch until this is fixed.

    When someone clicks on the referral link it goes to the homepage:
    http://www.example.com/?r=out2win, then if they click on any page including register it shows http://www.example.com/ with index.php or register.php and so on depending on what they click on. The referral part of the program gets lost or doesn't route correctly.

    Everything credits correctly when your referrals click on ads and you make a protion. But unless a username is physically imputed, I will only harvest unreferred members who will then be placed into the "available for sale" referrals.

    Thanks for the code, where would I place this so it will route? On the homepage correct? Where on the page?

    Thanks again, I'm new at this.

  5. #4
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Hi,

    I don't think HTTP_REFERRER is what you are looking for.

    I am understanding that you want to somehow make sure your r variable, in your example it would be out2win, sticks around and isn't lost when someone navigates away from the first page they come to on your site, where

    www.example.com/?r=out2win

    is in the user's browser's address bar.

    If this is the case, then you need to use a $_SESSION['variable'] to keep track of the referrer.

    So on any page that it is possible to have your referrer variable in the URL, you need to start a php session, session_start(); and then assign the r variable to a session variable like this:

    $_SESSION['r'] = $_GET['r'];

    Now the variable from the URL is stored as $_SESSION['r'] and you can use it anywhere on your site until the SESSION is destroyed or basically until the user leaves your website.

    If you have some more specific questions, I'll do my best to help out.

    Good luck,

    JasonD

  6. The Following User Says Thank You to JasonDFR For This Useful Post:

    OUT2WIN (01-05-2009)

  7. #5
    Join Date
    Dec 2008
    Location
    Fremont, CA
    Posts
    30
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Default

    Hi,

    Ok, I am not sure if my understand is correct or not, however i figure that you want an URL stick with the GET parameters through out the redirection?

    www.example.com/?r=out2win

    Heres an example that i could think of ...hope it helps.

    Filename: login.php
    PHP Code:
    <?php 
    $user 
    "user";
    $pass "pass";
        if(
    $user == $pass){
        
    $url "main.php?user=".$user;
        
    header('Location: '.$url);
        exit;
       }
    ?>
    The above example will redirect you to a page(main.php) which is within the current directory and the url will also contain ur $_GET parameters.
    You can use the above method to keep routing wherever u want with those $_GET parameters.

    Method to retrieve $_GET in the redirected-to page.
    PHP Code:
    <?php
    $user 
    $_GET['user'];
    echo 
    $user;
    ?>

Bookmarks

Posting Permissions

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