I wrote this cleanup function:

function cleanup($copy)
{
        $copy=trim($copy);
        $copy=htmlspecialchars($copy, ENT_QUOTES);
        $copy=eregi_replace ("%", "%", $copy);
        $copy=eregi_replace ("<", "&lt;", $copy);
        $copy=eregi_replace (">", "&gt;", $copy);
        $copy=eregi_replace ("&amp;", "&", $copy);
        $copy=nl2br($copy);
        $copy=StripSlashes($copy);
        return($copy);
}

nl2br converts the carriage returns into <br> or <br /> depending on your 
version of php.
So if you want to offer your copy for editing instead of viewing, you might 
want to run
$string=str_replace("<br />, "", $string);

The rest of the code removes characters that can be used for malicious coding.
You might want to edit it if you want them to enter html code.

I also made some functions to access MySQl easier with php:
http://zc8.com/zc8/ZC8news/shownews.php?articleid=98

You are welcome to use and modify the code

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to