LindaD Posted April 17, 2009 Share Posted April 17, 2009 Can someone please edit this for me to only strip the < > brackets? ??? <html> <?php if ($_POST["text"] == $null || $_POST["file"] == $null){echo'<title>Error!</title>You must at least save something - to leave it blank hit space bar a few times or add periods ...'; exit;} $text = $_POST["text"]; if (is_writable($_POST["file"]) && $_POST["overwrite"] == $null) { echo 'Error, file already exists'; echo '<title>Error!</title>'; exit; } $handle = fopen($_POST["file"], 'w'); if (get_magic_quotes_gpc()) { $text = stripslashes($text); } fwrite($handle, $text); if (get_magic_quotes_gpc()) { $text = stripslashes($text); } echo 'Success, wrote ('.$text.') to file ('.$_POST["file"].')'; echo '<title>Success!</title>'; fclose($handle); ?> </html> Quote Link to comment https://forums.phpfreaks.com/topic/154562-strip-brackets/ Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 $string = str_replace(array('<', '>'), '', $string); Quote Link to comment https://forums.phpfreaks.com/topic/154562-strip-brackets/#findComment-812749 Share on other sites More sharing options...
LindaD Posted April 17, 2009 Author Share Posted April 17, 2009 $string = str_replace(array('<', '>'), '', $string); Thanks Jack, it works Quote Link to comment https://forums.phpfreaks.com/topic/154562-strip-brackets/#findComment-812795 Share on other sites More sharing options...
.josh Posted April 17, 2009 Share Posted April 17, 2009 jack got it all wrong. It's like this: $text = str_replace(array('<', '>'), '', $text); Quote Link to comment https://forums.phpfreaks.com/topic/154562-strip-brackets/#findComment-812800 Share on other sites More sharing options...
jackpf Posted April 18, 2009 Share Posted April 18, 2009 Lol, I didn't actually read his code; I just made up my own variables. My apologies Quote Link to comment https://forums.phpfreaks.com/topic/154562-strip-brackets/#findComment-812842 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.