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] 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 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] 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. 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
Archived
This topic is now archived and is closed to further replies.