Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 11 of 11
  1. #1
    DNF Member
    gawnd's Avatar
    Join Date
    Jul 2007
    Location
    United States
    Posts
    588
    Blog Entries
    1
    DNF$
    2,098
    Bank
    0
    Total DNF$
    2,098
    Donate  

    Jump Script Parse Error

    I am going crazy trying to get a simple jump script setup for affiliate links.

    I keep getting the following error.
    PHP Parse error: parse error, unexpected T_STRING in Line 2

    on the following script:

    <?PHP
    if ($o == "l1") {$link = "http://www.example.com";} // Default link
    if ($o == "l2") {$link = "http://www.anotherexample.com";}
    header("Location: $link"); // Jump to the hiddden URL above
    exit();
    ?>
    Anyone have any idea what could be wrong here?

  2. #2
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,066
    Bank
    0
    Total DNF$
    6,066
    Donate  
    -where is $o defined?
    Code:
    <?
    switch($o)
    {
    case "l2":
    $redirect="http://www.link2.com";
    break;
    case "l1":
    $redirect="http://www.link1.com";
    break;
    }
    header("Location: ".$redirect);
    ?>
    Last edited by Bender; 10-26-2007 at 12:35 PM.

  3. #3
    DNF Member
    gawnd's Avatar
    Join Date
    Jul 2007
    Location
    United States
    Posts
    588
    Blog Entries
    1
    DNF$
    2,098
    Bank
    0
    Total DNF$
    2,098
    Donate  
    I have my links built like this:

    http://www.example.com/jumpscript.php?o=l1
    http://www.example.com/jumpscript.php?o=l2

    I tried the above script and got the same results. Even with a simple header redirect without variables, I'm getting parse errors. Could there be a server setting, htaccess or php.ini that I'm missing?

  4. #4
    Moderator
    Johnn's Avatar
    Join Date
    Apr 2004
    Location
    Pennsylvania
    Posts
    14,650
    Country

    United States
    DNF$
    3,595
    Bank
    0
    Total DNF$
    3,595
    Donate  
    Missing ";" at the end of line 2 and 3?

    HotWebTools.com
    Enamemart.com - Great Names For Sale
    CampusHut.com - Students Social Networking
    AAV.net AVU.net DGV.net EIE.net FEQ.net FVV.net GOY.net HFB.net MNV.net
    OAU.net OEA.net OOD.net OOM.net SUO.net UYO.net VHO.net XHN.net



  5. #5
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,066
    Bank
    0
    Total DNF$
    6,066
    Donate  
    Code:
    <?
    switch($_GET['o'])
    {
    case "l2":
    $redirect="http://www.link2.com";
    break;
    case "l1":
    $redirect="http://www.link1.com";
    break;
    }
    header("Location: ".$redirect);
    ?>

  6. #6
    DNF Member
    gawnd's Avatar
    Join Date
    Jul 2007
    Location
    United States
    Posts
    588
    Blog Entries
    1
    DNF$
    2,098
    Bank
    0
    Total DNF$
    2,098
    Donate  
    bender - that worked out. thanks so much.
    i had a combination of issues - one, was editing in wordpad for some reason and it was throwing in odd formatting.

    once i cleared that up, it was clear that the variable wasn't being defined and your new script solved that.

    thanks again.

  7. #7
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,066
    Bank
    0
    Total DNF$
    6,066
    Donate  
    glad to help whenever I can.

  8. #8
    Moderator
    Johnn's Avatar
    Join Date
    Apr 2004
    Location
    Pennsylvania
    Posts
    14,650
    Country

    United States
    DNF$
    3,595
    Bank
    0
    Total DNF$
    3,595
    Donate  
    Good job Bender.

    50 $F donated to your account.

    HotWebTools.com
    Enamemart.com - Great Names For Sale
    CampusHut.com - Students Social Networking
    AAV.net AVU.net DGV.net EIE.net FEQ.net FVV.net GOY.net HFB.net MNV.net
    OAU.net OEA.net OOD.net OOM.net SUO.net UYO.net VHO.net XHN.net



  9. #9
    DNF Member
    gawnd's Avatar
    Join Date
    Jul 2007
    Location
    United States
    Posts
    588
    Blog Entries
    1
    DNF$
    2,098
    Bank
    0
    Total DNF$
    2,098
    Donate  
    if you look online the first script i posted seems to be the norm. any specific reason the variable o wasn't being defined in my version?

    i'm still a copy and paste php hack, but slowly learning.

  10. #10
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,066
    Bank
    0
    Total DNF$
    6,066
    Donate  
    the $o variable wasn't defined - you expected to be automatically extracted from the $_GET variables, but this is no longer the case in newer PHP versions(security reasons)
    you could use an extract($_GET) but this NOT recommended

  11. #11
    Platinum Lifetime Member

    Join Date
    Nov 2006
    Location
    USA
    Posts
    493
    DNF$
    84
    Bank
    0
    Total DNF$
    84
    Donate  
    You could also do something like...

    Code:
    function pop_vals($associative_array) {
     foreach ($associative_array as $key=>$val) {
      eval('$'.$key.' = "'.$val.'";");
     }
    }
    
    pop_vals($_REQUEST);
    
    // $o should now be defined
    I do NOT recommend this, though, as someone could run...

    YOURURL?o=|1&SOMEREMOTECOMMANDSHERE

    Jason

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
  •  

Domain name forum recommended by Domaining.com