Re: works in 4.4.2 - breaks in 5.2.1
| From: | Jochem Maas | Date: | Tue, 05 Jun 2007 17:52:42 +0000 |
| Subject: | Re: works in 4.4.2 - breaks in 5.2.1 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256112@lists.php.net to get a copy of this message | ||
Jim Berkey wrote:
> I'm familiar with actionscript, but pretty new to php . . .I have a guestbook script that
> worked fine until my host upgraded to php 5.2.1 - can anyone tell me what part of my if statement or
> variable is breaking in 5.2.1? I send the new data with Flash using xml.sendAndLoad, to the xml file
> via standalone php file shown below.
> tia,
> jimbo
aside from the fact that this script has a big fat race condition waiting to happen,
and you should probably be using a database for storage, and that it seems to be possible
to inject just about *anything* into the guestbook.xml file (pr0n spam anyone?) ...
what exactly is going wrong?
at a guess $HTTP_RAW_POST_DATA is not set so nothing is being written, you
should use something like the following to get the data instead
(the comment is optional ;-):
// $xmlString is completely unvalidated/unsantized and could contain all sorts of crap!
$xmlString = file_get_contents('php://input');
also STFW, there is plenty out there regarding your problem, (including stuff
related specifically to flash), e.g.:
http://www.phpbuilder.com/board/showthread.php?t=10304087
>
> <?php
> $file = fopen("guestbook.xml", "w+") or die("Can't open XML
> file");
> $xmlString = $HTTP_RAW_POST_DATA;
> if(!fwrite($file, $xmlString)){
> print "Error writing to XML-file";
> }
> print $xmlString."\n\n";
> fclose($file);
>
> exit;
> ?>
>
>