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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.