in reply to Re: Re: Problems with ;'s
in thread Problems with ;'s

use CGI qw( escape ); #[...] if (isset($HTTP_POST_VARS)) { while (list ($header, $value) = each ($HTTP_POST_VARS)) { $QSTRING = $QSTRING.'&'.$header.'='.escape($value); } # I added this: ^^^^^^^ ^ }
You might also need to escape the $header.

Update: jryan points out that I've used a Perl module to update your PHP code. Perhaps someone can pipe up with the way to URL-encode values in PHP or you can just use the original, still-escaped query string instead of rebuilding it from the now-unescaped parameter values.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Problems with ;'s
by broquaint (Abbot) on Nov 09, 2001 at 22:47 UTC
    In case people wonder what the PHP equivalent of CGI's escape is, it's urlencode. So if we PHP-ify tye's code it might go a little something like this
    $QSTRING = $QUERY_STRING; $hpv =& $HTTP_POST_VARS; if(is_array($hpv) && count($hpv) > 0) foreach($hpv as $key => $value) $QSTRING .= '&'.$key.'='.urlencode($value);

    HTH

    broquaint

      YOU RULE!!!
      That works beautifully... Now I did have to so a s/\"/"/g and s/\'/'/g and a s/\\\\/\\/g but over all it works great now :)

      -----------------------
      Billy S.
      Slinar Hardtail - Guildless
      Datal Ephialtes - Guildless
      RallosZek.Net Admin/WebMaster
      Aerynth.Net Admin/WebMaster

      perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'