Jump to content

[SOLVED] php file write to .txt file


rcpopart

Recommended Posts

Okay so I have 3 files on one particular hosting company's server that together work fine. However, when I copy them over to 2 other different company's servers, they don't work. I have write permissions on both the sites that it doesn't work and at this point the only thing I can think of is that there are different versions of PHP on these servers and that's why it's working on 1 but not the other two. All the files are relative and not absolute paths. Here is how I have it set up. (I've written here before about this so I apologize if this looks like a repeat, but my problem seems unsolvable to me)

 

I have an .swf file with an input window and a "enter" button with this code on it:

 


on (release) {
loadVariablesNum ("write.php", 0, "POST");
}
on (release) {
input = "";
}

Link to comment
https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/
Share on other sites

The "write.php" file has this code only:

 


<?php 
function myurlencode($text)
{ $text = str_replace("%", "%25", $text);
$text = str_replace("&", "%26", $text);
return $text;
}
$data = "textfile.txt"; // make sure it has 666 permissions 
$fp = fopen($data, "window2="); 
fwrite($fp, "window2=" . myurlencode(stripslashes($input))); 
fclose($fp); 
echo "status=Done"; 
?> 



 

 

the php code then writes to a .txt file called textfile.txt.

 

 

Let me repeat that this set up works fine on 1 server, but not on the other 2.

 

All I keep getting on the .txt file is "window2=", when what I should get is "window2=The text I type into the input window from the .swf file"

 

Please help!

 

I believe my php code is too old to work on newer versions of php and that is the problem, but I am absolute newbie with php and don't know how to rewrite it to be compatible.

 

thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.