note 61500 added to function.str-replace
| From: | info at hp4 dot dk | Date: | Sun, 05 Feb 2006 20:27:30 +0000 |
| Subject: | note 61500 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103046@lists.php.net to get a copy of this message | ||
If you have a tagwall on you site and a user write "<" or ">"
You script will go to shit not work ;)
You can use this code to remove "<" and replace it whit >
$name = $_POST["name"];
$mail = $_POST["mial"];
$text = $_POST["text"];
$search_keys = array("$name","$mail","$text"); //This is here you
control where php shall search after the search word
$keys = array("<",">","<BR>"); //This is here you control
the search word
$key_replace = array("<\;",">\;","<\;BR>\;");
//This is the 'word' or 'code' the search word will be replacet whit
$special_keys =
str_replace("$search_keys","$keys","$key_replace"); //Here we onlye
set it in to the php finction :)
Good Luck
----
Server IP: 194.239.128.8
Probable Submitter: 80.162.204.104
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61500
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61500&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61500&report=yes
Search -- http://master.php.net/manage/user-notes.php