Re: Newbie Question

From: Date: Thu, 08 Nov 2001 16:23:20 +0000
Subject: Re: Newbie Question
References: 1  Groups: php.db php.general 
Request: Send a blank email to php-db+get-14147@lists.php.net to get a copy of this message
I wrote this cleanup function: function cleanup($copy) { $copy=trim($copy); $copy=htmlspecialchars($copy, ENT_QUOTES); $copy=eregi_replace ("%", "&#37;", $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

« previous php.db (#14147) next »