rcpopart Posted October 24, 2007 Share Posted October 24, 2007 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 = ""; } Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/ Share on other sites More sharing options...
rcpopart Posted October 24, 2007 Author Share Posted October 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377109 Share on other sites More sharing options...
trq Posted October 24, 2007 Share Posted October 24, 2007 You need to use $_POST['input'] instead of $input. Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377115 Share on other sites More sharing options...
kenrbnsn Posted October 24, 2007 Share Posted October 24, 2007 Where does the variable "$input" come from? Also the fopen statement is incorrect. It should probably be written as: <?php $fp = fopen($data,"w"); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377119 Share on other sites More sharing options...
Toshiba23 Posted October 24, 2007 Share Posted October 24, 2007 What the guy above me said... Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377124 Share on other sites More sharing options...
rcpopart Posted October 24, 2007 Author Share Posted October 24, 2007 thanks so much, guys. I'll try it out. Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377129 Share on other sites More sharing options...
rcpopart Posted October 24, 2007 Author Share Posted October 24, 2007 YES!!! SUCCESSS!!! YOU GUYS ROCK! Quote Link to comment https://forums.phpfreaks.com/topic/74611-solved-php-file-write-to-txt-file/#findComment-377133 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.