Vivid Lust Posted July 19, 2008 Share Posted July 19, 2008 I have a code which opens a css files and then saves it again: <?php session_start(); if(!isset($_SESSION['admin'])){ header('location: ../admin.php'); } $filename = "../css.css"; $file = fopen( $filename, "r" ); $filesize = filesize($filename); $text = fread( $file, $filesize ); fclose( $file ); ?> <form action=editcssdone.php method=POST> <textarea name="top" id="textarea" cols="70" rows="10" > <?php echo $text; ?> </textarea> <Br> <input type="Submit" value=Update> </form> <?php session_start(); if(!isset($_SESSION['admin'])){ header('location: ../admin.php'); } $top = $_POST['top']; $filename = "../css.css"; $file = fopen( $filename, "w+" ); fwrite( $file, $top ); fclose( $file ); header('location: editcss.php'); ?> It keeps on adding brackets on this: url("http://valiants.freehostia.com/uploads/903573218footer.jpg"); so that its like this: url(\"http://valiants.freehostia.com/uploads/903573218footer.jpg\"); Can anyone help sort the problem of these annoying slashes??? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/ Share on other sites More sharing options...
ignace Posted July 19, 2008 Share Posted July 19, 2008 stripslashes() Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/#findComment-594388 Share on other sites More sharing options...
Vivid Lust Posted July 19, 2008 Author Share Posted July 19, 2008 do what with that? Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/#findComment-594391 Share on other sites More sharing options...
wildteen88 Posted July 19, 2008 Share Posted July 19, 2008 fwrite( $file, stripslashes($top) ); Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/#findComment-594393 Share on other sites More sharing options...
pinacoladaxb Posted July 19, 2008 Share Posted July 19, 2008 It's called magic quotes. It adds slashes automatically. It's stupid, it causes more problems than it solves, and it was removed in PHP 6. Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/#findComment-594405 Share on other sites More sharing options...
NathanLedet Posted July 19, 2008 Share Posted July 19, 2008 Here's a few resources with some examples http://us2.php.net/stripslashes http://www.w3schools.com/php/func_string_stripslashes.asp Quote Link to comment https://forums.phpfreaks.com/topic/115627-php-is-adding-brackets-ahh/#findComment-594412 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.