Help // PHP Redirect file page error

Discussion in 'PHP' started by projectv3, May 7, 2007.

  1. #1
    hey all

    just a quick overview of what i have:

    i setup a site: http://www.mydomain.com
    i want to cloak affiliate links with a php redirect script.

    below is what i have within a link.php file
    <?
    $offer = $_GET['offer'];
    $type = $_GET['type'];
    
     if ($offer == "xxx")
    	{$jumplink= "http://affiliateid.product.hop.clickbank.net";}
    	
     if ($offer == "Ringtones")
    	{$jumplink= "http://www.yoursite2.com";}
    
     if ($offer == "Hosting")
    	{$jumplink= "http://www.yoursite3.comx";}
    	
    
    header("Location: ".$jumplink."&sub=".$type."");
    ?>
    PHP:
    then i go and add the link http://www.mydomain.com/link.php?offer=xxx

    but for some reason it doesnt work, and i get a page doesn not exist :(

    i've also tried a simliar version:

    <?php 
    if ($m == "") {$link = "http://www.mydomain.com/";} // No referrer? Go home. 
    
    if ($m == "xxx") {$link = "http://affiliateid.produce.hop.clickbank.net/";} 
    
    header("Location: $link"); // Jump to the affiliate URL. 
    exit(); 
    ?> 
    PHP:
    with http://www.mydomain.com/test.php?m=xxx

    and still no go :confused:

    i cant for the love of me figure out why, is there a server setting which i have to do, or do i have to add lines to my .htaccess file??

    any suggestions will be greately appreciated
     
    projectv3, May 7, 2007 IP
  2. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Try:
    header("Location: $jumplink&sub=$type");
    PHP:
    or
    $url = "$jumplink . "&sub=" . $type";
    header("Location: $url");
    PHP:
    Just a thought, a similar fix worked for me once.
     
    dp-user-1, May 7, 2007 IP
  3. projectv3

    projectv3 Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hey thanks for the suggestion

    i just tried both on the file and still the same thing, the 2nd one gave me and "error on line 14" where $url was placed

    would this have to do w/ anything on my server that i'd have to set?
     
    projectv3, May 7, 2007 IP
  4. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #4
    Did you forget the trailing semicolon?
     
    dp-user-1, May 7, 2007 IP
  5. projectv3

    projectv3 Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i copy and pasted it right into the existing file =\

    after tryin different version of the code something makes me feel like i have to edit my .htaccess file or something else ont he server ... so confused about this
     
    projectv3, May 7, 2007 IP
  6. projectv3

    projectv3 Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    *update, i took out

    "&sub=".$type.""

    and was ok :D
     
    projectv3, May 8, 2007 IP
  7. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #7
    Congratulations. :)
     
    dp-user-1, May 8, 2007 IP