note 50700 deleted from function.str-replace by bjori

From: Date: Sun, 26 Mar 2006 22:25:19 +0000
Subject: note 50700 deleted from function.str-replace by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106674@lists.php.net to get a copy of this message
Note Submitter: Jesse ---- str_replace can do many things, including smileys, bad word replacement, and even manually taking out bad HTML code. doing smileys is easy, first, create a jpg called smiley and add the following code to your form handling script: $posting = str_replace(":)", "<img src=smiley.jpg width=50 height=50>", $posting); also, taking out bad words is easy, too: $posting = str_replace("badword", "*******", $posting); then, lets say you want a form handler that keeps some HTML code to let people do things like post images, but not let them change the page's formatting. use str_replace! $posting = str_replace("BADHTMLCODE", "", $posting); finally, you can even make a scripting language like vBcode, like this: $posting = str_replace("[IMG]", "<img src>", $posting); $posting = str_replace("[URL]", "<a href>", $posting); $posting = str_replace("[/URL]", "</a>", $posting); $posting = str_replace("[CODE]", "<pre><p>code:</p>", $posting); $posting = str_replace("[/CODE]", "</pre>", $posting); The list of things you can do goes on and on!

« previous php.notes (#106674) next »