\n";
$url = 'http://www.psy.gla.ac.uk/~steve/tmp/z.php?var=asdf%3Cqwer';
//$url = preg_replace('/ /', '%20', $url);
$buf = file_get_contents($url);
if ($buf) { $s = 'succeeded'; } else { $s = 'failed'; };
echo "Fetch $s.
\n";
/*
myurlencode: split at ?
Any request part needs urlencode (sps to +)
but main URL needs sp to %20
I.e. encode request separately at assembly; encode file part just with sp-trans
FILENAME PART
Raw html : allows sp, %20, &, &, <, %3C, < in filenames
Fetch: can't take sp; or & or < or <
allows %20, %3C, & in filename
Header(): more liberal, but can't take < etc. Can take % codes.
Full algo would be:
(Split off request part and the ?)
translate \ to /
Decode & stuff
split on /
rawurlencode each part
rejoin
Full algo for request part: try urlencode it as a whole?
How to stop re-coding % codes? Decode then encode?
REQUEST PART
Raw html: allows sp, +, %20, %3C
can't allow &, &, <, <, as part of value
Fetch: allows +, %20, %3C
can't take sp, &, &, <, <,
*/
echo $buf;
?>
Web site logical path: [www.psy.gla.ac.uk] [~steve] [tmp] [this page]
XXXX
Web site logical path:
[www.psy.gla.ac.uk]
[~steve]
[tmp]
[this page]
[Top of this page]
header("Location: http://www.psy.gla.ac.uk/~steve/"); ?>
Web site logical path: [www.psy.gla.ac.uk] [~steve] [tmp] [this page]
XXXX
Web site logical path:
[www.psy.gla.ac.uk]
[~steve]
[tmp]
[this page]
[Top of this page]
REQUEST:
";
foreach ($_REQUEST as $key => $val) { echo "$key => $val
"; };
echo "
GET:
";
foreach ($_GET as $key => $val) { echo "$key => $val
"; };
echo "
POST:
";
foreach ($_POST as $key => $val) { echo "$key => $val
"; };
//phpinfo();
?>
link $cmd = 'date '; $cmd = 'wtable < q.tab;'; $cmd = 'mydate 3'; system('(export PATH=.:/home/steve/bin:$PATH ;' . $cmd . ') 2>&1'); system("echo '$cmd'" . '; 2>&1'); worked system('export PATH=.:$PATH ; q; 2>&1'); Works! system('csh -c " set path = (. $path); echo $path; " 2>&1'); system('$PATH = '.' $PATH; echo $PATH; 2>&1'); system('ls -l ./q 2>&1'); system('cp /bin/date q 2>&1') ?>
system('pwd 2>&1') ?>
system('echo $PATH 2>&1') ?>
system('ls -l q.php 2>&1') ?>
system('csh -c " echo hallo; " 2>&1'); ?>
system('./mydate 2>&1') ?>
Some code lumps Pretty print for arrays / structs: function pp($arr){ $retStr = '