Page 1 of 1

apostrophe's work!

Posted: Tue Oct 07, 2003 4:35 am
by mesz
this link shows just one of my many attempts to remove apostrophes from messageboard updates.
I tried everything: ereg_replace, str_replace, rawurlencode, in the end it was very simple.
viewtopic.php?p=63124#63124

Here is a script that removes apostrophe's from messageboard uploads that new users of PHP will probably benefit from:

Code: Select all

<?php
$fp = fopen('./news.txt','a+'); 
if($HTTP_POST_VARS['submit']) 
         { 
                  $line = date("m.d.y")  . "|" . $HTTP_POST_VARS['name']; 
                  $line .= "|" . $HTTP_POST_VARS['news']. "|" . $HTTP_POST_VARS['poster']; 
                  
                  $line = str_replace("\r\n","<br>",$line); 
                  $line = stripslashes($line); 
                  
                  $line .= "\r\n";  
                  fwrite($fp, $line); 
            } 
?>