apostrophe's work!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

apostrophe's work!

Post 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); 
            } 
?>
Post Reply