redirect a user

Discussion in 'Programming' started by candle21428, Dec 3, 2006.

  1. #1
    Hi there,

    This is what I am doing right now: in order to track how well a cpc campaign convert for my affiliate program, I have add a page called redirect.php where the conversion code was inserted.

    But the problem I am facing is that I will have to make a redirect page for each program to redirect the user. I am wondering how I could setup ONE redirect.php page and use something like http://mysite.com/?sid=123 (or whatever number that is) to make things easier.

    Any help or comment would be appreciated. :)
     
    candle21428, Dec 3, 2006 IP
  2. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So you want something like: mysite.com?refid=123 .. from there it will update SQL then redirect to the correct program?
     
    CodyRo, Dec 4, 2006 IP
  3. candle21428

    candle21428 Well-Known Member

    Messages:
    311
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Yes, something like that. Can you show me a web site or a sample script so that I can learn from it?

    Thx
     
    candle21428, Dec 4, 2006 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    something like

    
    <?
    switch($_GET['ref'])
    {
    	case 123:
    	mysql_query("UPDATE `table` SET key = 'value' WHERE entry = '123'");
    	header("location: whatever.php?refid=123");
    	break;
    	
    	case 124:
    	mysql_query("UPDATE `table` SET key = 'value' WHERE entry = '124'");
    	header("location: whatever.php?refid=124");
    	break;
    }
    ?>
    
    PHP:
    is I think what you want....
     
    krakjoe, Dec 4, 2006 IP