How to write phpinfo with special character to file
hi, hope u guys can help me
http://192.168.2.101/write.php?info=test&abcd
my write.php file:
RESULT = test
but it should be = test&abcd
how can i do that?
thanks
http://192.168.2.101/write.php?info=test&abcd
my write.php file:
<?php
$newUrl = html_entity_decode($_GET["info"]);
file_put_contents("log.txt", $newUrl. "\r\n", FILE_APPEND | LOCK_EX);
?>
RESULT = test
but it should be = test&abcd
how can i do that?
thanks
Please also mark the comments that contributed to the solution of the article
Content-Key: 322359
Url: https://administrator.de/contentid/322359
Printed on: April 18, 2024 at 18:04 o'clock
11 Comments
Latest comment
Use urlencode() and urldecode() instead for encoding strings which are used as parameters, or use POST instead of GET.
http://php.net/manual/de/function.urlencode.php
Regards
Seien Sie vorsichtig beim Umgang mit Variablen, die HTML-Entities enthalten könnten. Angaben wie &, © und £ werden vom Browser geparst und die eigentliche Entität wird anstelle des gewünschten Variablennamens verwendet. Dies ist eine naheliegende Schwierigkeit, über die das W3C bereits seit Jahren informiert. Die entsprechende Referenz finden Sie hier: » http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2.
Regards
Zitat von @thankusomuch:
thanks u so much for helping
but didnt work
Wrong!!thanks u so much for helping
but didnt work
> file_put_contents("log.txt", urlencode($_GET["info"]). "\r\n", FILE_APPEND | LOCK_EX);
>
You have to first encode the string for the url parameter
So the URL needs to look like
http://192.168.2.101/write.php?info=test%26abcd
PLEASE READ THE DOCUMENTATION FIRST, THANKS!
and i have to change the url before i send it?
Yes, that's the key. You do this with urlencode, how i described above.Zitat von @thankusomuch:
ok thats strange because in the full phpinfo page it shows up correctly?
so why can i not just grab the full line from there , convert it and extract it to the logfile. possible?
??????? You are writing in crosswords ok thats strange because in the full phpinfo page it shows up correctly?
so why can i not just grab the full line from there , convert it and extract it to the logfile. possible?
http://www.jonasjohn.de/snippets/php/phpinfo2file.htm
You need to rename your function because ist overwrites the original phpinfo() function.
You are still writing in crosswords... im out now in this crackbrained beginner session ..
You are still writing in crosswords... im out now in this crackbrained beginner session ..