Demonic Posted August 12, 2006 Share Posted August 12, 2006 [code=php:0]<?$javascript = "javascript.txt";$open =fopen($javascript,'w');$script = $_POST[info];if(isset($post)){if(is_writable($javascript)){fwrite($open,$script);echo "Written Successfully";}}else{echo "Couldn't write to File";echo "<center><form method='post'><textarea name='info'></textarea><br><input type='submit' name='post' value='post'></form></center>";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17339-so-this-adds-a-backslash-for-some-reason-anyone-know-why/ Share on other sites More sharing options...
poirot Posted August 12, 2006 Share Posted August 12, 2006 Magic Quoteshttp://www.php.net/magic_quotes Quote Link to comment https://forums.phpfreaks.com/topic/17339-so-this-adds-a-backslash-for-some-reason-anyone-know-why/#findComment-73704 Share on other sites More sharing options...
wildteen88 Posted August 12, 2006 Share Posted August 12, 2006 You might have magic_quotes enabled. Use [code=php:0]set_magic_quotes_runtime(0)[/code] at the top of your script to turn off magic quotes for your script.Also I'd chnagew your script to this:[code=php:0]<?php// turn off magic quotesset_magic_quotes_runtime(0);if(isset($_POST['info'])){ $javascript = "javascript.txt"; if(is_writable($javascript)) { $open = fopen($javascript, 'w'); $script = $_POST['info']; fwrite($open, $script); echo "Written Successfully"; } else { echo "Couldn't write to File"; }}else{ // this is a HEREDOC statement. echo <<<HTML<center> <form method="post"> <textarea name="info"></textarea><br> <input type="submit" name="post" value="post"> </form></center>HTML;}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17339-so-this-adds-a-backslash-for-some-reason-anyone-know-why/#findComment-73705 Share on other sites More sharing options...
Demonic Posted August 12, 2006 Author Share Posted August 12, 2006 yeah thanks for the tipsive done stripslashes() works perfectly now. Quote Link to comment https://forums.phpfreaks.com/topic/17339-so-this-adds-a-backslash-for-some-reason-anyone-know-why/#findComment-73707 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.