advanced SubID tracking with PHP

Discussion in 'Affiliate Programs' started by baduist, Mar 23, 2009.

  1. #1
    Hi all,

    I have decided to make subID tracking more comfortable by adding the subID to the URL of my landing pages, so the flow is:

    1. I make a new ad, and make up a sub id (ex. "flowers").
    2. In the ad I use the url www.myLP.com/?subid=flowers.
    3. On my landing page, I get 'flowers' and store it (db/cookie).
    4. Then when the users clicks on my hotlink to azoogle, I get the stored subid and ad it to the affiliate link, i.e. 'http://x.myaffillink.com/?sub='.$subid'

    If this would work it would be great, 'cause I could make up subID's on the fly... The problem is most of my subID's appear blank in azoogle, I guess I'm not storing it right. I'd appreciate your help...

    This is how I'm doing it now:
    1. on my LP's header.php (which appears on all pages), I [GET] the users' IP and the subID from the URL, then I store them in the database.

    2. When they click my banners/whatever, they get a redirect.php which contains two parts:
    a. [GET] user ip again, and look for it in the db:
    $ip = $_SERVER['REMOTE_ADDR'];
    then $query = mysql_query("SELECT * FROM table WHERE ip='$ip' AND NOT subid='none' ORDER BY time DESC LIMIT 1
    while($row = mysql_fetch_array($query)) {
    $mysubid = $row['subid'];
    };


    That *should return* the right column where the same ip is used, only if the "subid" column in the db isn't "none"..

    b. redirect to $affil_link2 = "http://x.azjmp.com/1F8nb?sub=".$mysubid;


    I suspect that my SQL query is wrong... can anyone take a look and share some advice?

    Thanks!
     
    baduist, Mar 23, 2009 IP
  2. money4leads

    money4leads Well-Known Member

    Messages:
    117
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #2
    money4leads, Sep 1, 2009 IP