MadnessRed Posted May 23, 2008 Share Posted May 23, 2008 i have an fwite script which writes to a txt file which i am php including. If I write this to the file <?php include('../base/newbox.php'); ?> it gets written as <?php include(\'../base/newbox.php\'); ?> any ideas how to stop it writing the '/'s? Quote Link to comment Share on other sites More sharing options...
gamefreak13 Posted May 23, 2008 Share Posted May 23, 2008 Is it only adding it on the right side? I think your looking for stripslashes();. Whatever variable is outputting that, try this.. stripslashes($outputtotxt); Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted May 23, 2008 Author Share Posted May 23, 2008 yes sorry, there are 2 slashes no both sides, its just the forum does funny things to back slashes [ code ] here is my code $flsh = '../data/profile/flash.txt'; $flash=$_GET["flash"]; $handlefl = fopen($flsh, 'w'); fwrite($handlefl, $flash); and <?php include('data/profile/flash.txt'); ?> whereabouts do i put the strip slashes? Quote Link to comment Share on other sites More sharing options...
gamefreak13 Posted May 23, 2008 Share Posted May 23, 2008 I thought you were writing the php include to a text file. If you are just inserting the php incude in a php page, then I can't imagine why it would do that. Quote Link to comment Share on other sites More sharing options...
MadnessRed Posted May 23, 2008 Author Share Posted May 23, 2008 sorry i wasn't clear, i have an fwrite script that lets the user wrote a bit of code to a text file I think am including the text file in the main document in a sepperate box I want the user to be able to add <?php include('../base/newbox.php'); ?> to the text file which will give them a second box so for example flash.txt may say <u>Information 1</u><br> I like chips <?php include('../base/newbox.php'); ?> <u>Information 2</u><br> I don't like bread however if I add hte php include script into flash.txt its changes ' to /' then says it wasn't expecting a / and erors. Quote Link to comment Share on other sites More sharing options...
gamefreak13 Posted May 23, 2008 Share Posted May 23, 2008 Ok so your actually writing the code to a text file.. exactly as I see it now, or are you writing the text above/below AND the contents of newbox.php? <u>Information 1</u><br> I like chips <?php include('../base/newbox.php'); ?> <u>Information 2</u><br> I don't like bread Or are you writing... <u>Information 1</u><br> I like chips (the output of the php part) <u>Information 2</u><br> I don't like bread The reason this is happening is because magic_quotes_gpc is enabled on your server (like most servers). This setting automatically adds the slashes. So you need to strip them. If you are writing the actual php code to a text file, then whatever variable that text is stored in.. use this: $mytext = "<u>Information 1</u><br> I like chips <?php include('../base/newbox.php'); ?> <u>Information 2</u><br> I don't like bread"; // This will output // <u>Information 1</u><br> // I like chips // <?php include('../base/newbox.php'); ?> // <u>Information 2</u><br> // I don't like bread stripslashes($mytext); Quote Link to comment 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.