Results 1 to 7 of 7
  1. #1
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    Custom bounce.php broke
    I have a php script called bounce.php where I route some of my links through. I read the query string and then load a new page using everything after the "?u=".

    It looks something like this, which works fine.
    Code:
    www.site.com/bounce.php?u=http://www.someothersite.com/cccc/ccc
    However, if the link after the ?u= has a "$url=" in it, bounce.php breaks.
    This causes a problem.
    Code:
    www.site.com/bounce.php?u=http://www.someothersite.com/?url=http://blahblah.com/cccc/ccc
    This is the actual error page that comes up after clicking on a link like that:

    Not Acceptable
    An appropriate representation of the requested resource /bounce.php could not be found on this server.

  2. #2
    ABW Ambassador MoneyBusiness's Avatar
    Join Date
    March 14th, 2006
    Posts
    2,051
    Just curious,SB, do you have access to an .htaccess file on that directory? If so, does bounce.php require anything to be changed it in? May be a way to fix it if there is.

    edit: if you get around to it, and the above is true, take a look at:

    http://forum.abestweb.com/showthread.php?t=95723

    the solution there will allow you to pass a url, with the specified characters.

  3. #3
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    I have access to the .htaccess file, but there is nothing in there for bounce.php.

    Here is pretty much the gist of bounce.php other than the javascript to open new window.

    Code:
    $qs = $_SERVER["QUERY_STRING"];
    $myurl = substr($qs, 2 , strlen($qs));

  4. #4
    Moderator MichaelColey's Avatar
    Join Date
    January 18th, 2005
    Location
    Mansfield, TX
    Posts
    16,232
    Perhaps you need to URL Encode the u= parameter? For instance:

    Code:
    www.site.com/bounce.php?u=http%3A%2F%2Fwww.someothersite.com%2F%3Furl%3Dhttp%3A%2F%2Fblahblah.com%2Fcccc%2Fccc
    Michael Coley
    Amazing-Bargains.com
     Affiliate Tips | Merchant Best Practices | Affiliate Friendly? | Couponing | CPA Networks? | ABW Tips | Activating Affiliates
    "Education is the most powerful weapon which you can use to change the world." Nelson Mandela

  5. #5
    ABW Ambassador meadowmufn's Avatar
    Join Date
    January 18th, 2005
    Location
    Seattle
    Posts
    2,587
    I think it's getting confused because there are two ?'s in the query string. I think Michael's solution of urlencoding should do the trick. Then just urldecode before you set $myurl.

    Like this:


    Code:
    $qs = $_SERVER["QUERY_STRING"];
    $qs = urldecode($qs);
    $myurl = substr($qs, 2 , strlen($qs));
    -Don't criticize anyone til you've walked a mile in their shoes. Then when you do criticize them, you'll be a mile away and have their shoes.
    - Silence is golden. Duct Tape is silver.

  6. #6
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    I still get the same thing. I will keep searching.

  7. #7
    Grandma broke her coccyx! Uncle Rico's Avatar
    Join Date
    May 8th, 2007
    Location
    North Carolina
    Posts
    2,238
    Ok, you guys are right. I was only doing half of the work. I forgot to urlencode the string. I was only urldecoding the string in bounce.

    Code:
    Step 1 - (building link):
    $encodedUrl = urlencode($url);
    
    Step 2 - (accessing link):
    $decodedUrl = urldecode($url);

  8. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: February 5th, 2013, 04:45 PM
  2. Replies: 5
    Last Post: February 26th, 2012, 09:00 AM
  3. PHP question - include(file.php) with variables
    By teezone in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: September 4th, 2009, 04:54 PM
  4. Custom Database(MyPhpAdmin) and PHP Needed
    By CustomersFirst in forum Couponer's Corner
    Replies: 0
    Last Post: March 15th, 2008, 03:41 PM
  5. OK, Who broke It?
    By Mr. Sal in forum Midnight Cafe'
    Replies: 11
    Last Post: December 12th, 2006, 09:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •