SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Yakima WA USA
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    header link being blocked/truncated by '&'

    I am trying to redirect a link using the following:


    "Index.php"

    $SaleURL = purchase.php?link=http://click.linksynergy.com/fs-bin/click?id=xxxxxxxx&offerid=101744.23405&type=15&subid=0;

    print "<a href=\"" . $SaleURL ."\">Click Here!</a>';



    "purchase.php"

    $link = $_GET['link'];
    header ('location: " . $link);

    Most of the ugly, long URLs transfer through Header just fine - ones of the type shown are sent correctly (according to the access.log file from Apache) but are truncated (in Header???) just before the first '&' sign in the ones that include a combining '&' sign.

    IE - the link being sent from the header function is of the form:

    $link = purchase.php?link=http://click.linksynergy.com/fs-bin/click?id=xxxxxxxxxxx

    Any thoughts what I can do to fix this?

    Thanks - Charles

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    print "<a href=\"" htmlspecialchars($SaleURL) ."\">Click Here!</a>'; 

  3. #3
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    See here,

    http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2

    B.2.2 Ampersands in URI attribute values
    The URI that is constructed when a form is submitted may be used as an anchor-style link (e.g., the href attribute for the A element). Unfortunately, the use of the "&" character to separate form fields interacts with its use in SGML attribute values to delimit character entity references. ...


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
  •