Forum Moderators: coopster

Message Too Old, No Replies

stripping slashes, What am i doing wrong?

         

heymister

5:37 pm on Aug 15, 2006 (gmt 0)

10+ Year Member



before i start I a designer and coding is not my forte, so this is all in an attempt to better understand the mechanics of websites therefore please understand when I start asking the stupid questions!
I'm attempting to build a Content management system using PHP HTML(and iframe) and txt files to store info.... Im deliberatly avoiding databases!
Ok so I'm designing a module that
1)passes a HTML file (full of links) into PHP
2)then creates a txt file from that
3)which in the following pageis loaded in Iframe
4) so that my client can see a list of links in HTML (as you would see it in notepad)
5)then they copy it into a Html form to edit the links
6)then is taken by PHP and overwrites the original HTML file

I have achieved this, however there is a problem... My server seems to run magicquote and is adding slashes throught the links! which I don't mind except I cannot for the life of me figure how to use the stripslashes command! Obviously this renders the links useless!
heres the php from stage 6 which is where I assume I would have to add strip slashes...somehow.

ANY HELP GRATEFULLY RECIEVED! but please spell it out for me im not the sharpest tool in the box. thanks.
<?php

//posts the amended data from the Html form
$content1_txt = $_POST['content1_txt'];

//create and open the text file
$fp = fopen("htmlnews.html","w+");

//if u can't create or open the file say error if not say...
if(!$fp) {
echo 'Error, the file could not be opened or there was an error creating it.';
exit;
}else { echo 'Your content has been saved.';
}

//put data from the form into the text file
fwrite ($fp, $content1_txt);
?>
}

?>
}

dreamcatcher

6:47 pm on Aug 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi heymister, welcome to Webmaster World. :)

If the slashes are being added when you write the data, this should be fine:

fwrite ($fp, stripslashes($content1_txt));

dc

heymister

7:33 pm on Aug 15, 2006 (gmt 0)

10+ Year Member



thanks i'll try it! :D

heymister

7:38 pm on Aug 15, 2006 (gmt 0)

10+ Year Member



Cheers dreamcatcher that worked a treat! Most appreciated.

dreamcatcher

8:25 pm on Aug 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anytime. :)