sub-id tracking with a redirect page?

Status
Not open for further replies.

clownstep

Banned
Mar 7, 2008
138
0
0
I want to setup sub-id tracking like this:There is going to be a promo code box on my landing page when the customer enters a 3 digit promo code, I want my website to go to a redirect page and then to the networks landing page but, I would like that promo code to be appended to the affiliate link.Example:customer goes to landing page ----> enters promo code (123) -----> redirect page -----> networks landing page : hxxp://www.networkpage.com?subid=123 Can somebody help in setting this up, I only have basic html skills but, I think this could probably work in php, maybe I can do it with some assistance.Thanks!
 


Heres the redirect code I use on my offers:

First you need to build this MySQL table, run this code in PhpMyAdmin
Code:
  CREATE TABLE `databasename`.`tablename` (
`id` INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`keyword` VARCHAR( 255 ) NOT NULL ,
`raw` VARCHAR( 255 ) NOT NULL ,
`count` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM

Code:
<?
if(isset($_GET['OVKEY']))
{
    //$rawkeyword = $_GET['OVRAW'];
    //$rawkeyword = urldecode($rawkeyword);
    $keyword = $_GET['OVKEY'];
    $keyword = urldecode($keyword);
    
    $link = mysql_connect('localhost','dbuser','pass');
    mysql_select_db("DB NAME", $link) or die("An error occured while trying to establish a connection to the specified database");
    
    $sql = "SELECT * FROM keywords WHERE keyword = '$keyword' AND cid = '1'";
    $result = mysql_query($sql);
    if(mysql_num_rows($result) == 0)
    {
        $sql = "INSERT INTO keywords (`id` , `keyword` , `count`, `cid`) VALUES ('', '$keyword','0','1')";
        $result = mysql_query($sql) or die(mysql_error());
    }
    $sql = "UPDATE keywords SET count = count+1 WHERE keyword = '$keyword' AND cid = '1' LIMIT 1";
    $result = mysql_query($sql);
    $sql = "SELECT * FROM keywords WHERE keyword = '$keyword' AND cid = '1'";
    $result = mysql_query($sql);
    $result = mysql_fetch_row($result);
    $subid = $result[0];
    mysql_close($link);
}
header("Location:http://yournetworkurl.com?subid=".$keyword.");
?>
Basically what that code does is take the keyword out of $OVKEY and throw it into a DB if it hasn't been before. It assigns it to an Id and passes the id as the subid. You'll have to modify the code a little bit to fit your needs probably but that should get you started.
 
  • Like
Reactions: JoeZ
Status
Not open for further replies.