Newbie problem with $_POST

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I ran into a problem with the $_POST feature in my scripts.  I just changed  
over to a new hosting company and now some of my scripts are acting wierd.  
I know it is probably a setting in the PHP.ini file, but I have no idea what  
to look for.  The old server ran 4.2.2 and the new server runs 4.4.2

In my script I use $_GET to get the name of the text file that needs to be  
created and $_POST to get the content to post to the text file.  I added  
error checking and the results (displayed using ECHO statements) of the  
script should return either "Success", "Unable to open file" or "Unable to  
save data".  Using these results my program knows if the file was created.  
This all worked just fine until I started testing on the new server.  Now  
the script returns the data that was sent during the post (writevar=my data  
to be posted) instead of any of the three possible results.  The file is  
being successfully created, just that the script is now returning a  
statement that I have no idea where it is coming from.

Any ideas?

Thanks in advance.


Re: Newbie problem with $_POST

To help you out, we need some code.

Re: Newbie problem with $_POST

Here is some sample code from my script.

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$filename = $_GET['textfilename'];
$contents = $_POST['writevar'];
$filetype = strstr($filename, '.txt');
if ($filetype <> '.txt') {
    echo 'Error.  Cannot open file.';
   if (!$handle = fopen($filename, 'w')) {
         echo "Error.  Cannot open file.";
   if (fwrite($handle, $contents) === FALSE) {
       echo "Error.  Cannot write to file.";
   echo "Success";

Quoted text here. Click to load it

Re: Newbie problem with $_POST

Chris wrote:
Quoted text here. Click to load it

I must say that is weird.  Are you including anything?  Can you get the  
php.ini settings?  I would try contacting your host or changing the POST  
name, as there may be some setting that is outputting it.

Carl Vondrick
usenet [at] carlsoft [dot] net

Re: Newbie problem with $_POST

Fixed it.  It was the zlib_compression option in the php.ini file.  It has  
to be turned off for my app to work.

Quoted text here. Click to load it

Site Timeline