Kaboom Posted June 19, 2010 Share Posted June 19, 2010 Okay were making an admin portal for our customers we do webdesign for but still host and for some reason it will not get rid of the \'s. Here's what I am using: $content = $_POST['content']; $fh = fopen("$path", 'w') or $message = " <br /><font color=\"red\">Can't open file.</font><br />"; stripslashes ($content); fwrite($fh, $content); fclose($fh); header("location: index.php"); It makes them redirect when it is done, shows an error if not, so ... why does it keep adding \'s? it can display it without them but it's randomly tossing it in there. Quote Link to comment https://forums.phpfreaks.com/topic/205228-removing-slashes/ Share on other sites More sharing options...
mrMarcus Posted June 19, 2010 Share Posted June 19, 2010 Adds slashes to what? $_POST['content']? Quote Link to comment https://forums.phpfreaks.com/topic/205228-removing-slashes/#findComment-1074227 Share on other sites More sharing options...
Kaboom Posted June 19, 2010 Author Share Posted June 19, 2010 A demo site of the code: http://tyler.geeksnetwork.org/demo/index.php goto the admincp and then you can edit the home.txt BUT when you do a link, <a href="" it makes it <a href\"\" even though I have strip slashes remove them... it only happens during post not load so if its in txt file already it works but if it isn't then you save with them it adds slashed and idk why. Quote Link to comment https://forums.phpfreaks.com/topic/205228-removing-slashes/#findComment-1074229 Share on other sites More sharing options...
trq Posted June 19, 2010 Share Posted June 19, 2010 I would say you have magic quotes enabled. You can check this using get_magic_quotes_gpc then remove them using stripslashes. eg; if (get_magic_quotes_gpc()) { $content = stripslashes($_POST['content']); } else { $content = $_POST['content']; } Quote Link to comment https://forums.phpfreaks.com/topic/205228-removing-slashes/#findComment-1074234 Share on other sites More sharing options...
Kaboom Posted June 19, 2010 Author Share Posted June 19, 2010 Tysm!!! IT worked perfectly I tried that before but had bad syntax lol Quote Link to comment https://forums.phpfreaks.com/topic/205228-removing-slashes/#findComment-1074262 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.