note 71514 added to function.preg-replace
| From: | pat at osu1 dot php dot net | Date: | Sun, 03 Dec 2006 23:15:09 +0000 |
| Subject: | note 71514 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120255@lists.php.net to get a copy of this message | ||
Hi
I use a form with a textarea.
when i see an error with entered data, i call back the same form script.
by using the nl2br fonction in my textaera validation scritp, it modifies the textearea content with
"<br />"
but each time i submit, if in other field contens error, it adds a new "<br />" in
the textarea content.
i made this but it does not work. As i'm new, i would appreciate some help...
$str['a'] = preg_replace('/^({<br />})+$/','<br
/>',$str['a']);
by the way, anyone made some script to secure the content entered in a textarea? to avoid security
issues?
$str['a'] =
str_replace('<?php>','',$_REQUEST['a']);
$str['a'] = str_replace('<?>','',$str['a']);
$str['a'] = str_replace('?>','',$str['a']);
$str['a'] = str_replace('<html>','',$str['a']);
$str['a'] =
str_replace('</html>','',$str['a']);
$str['a'] = str_replace('<body>','',$str['a']);
$str['a'] = str_replace('</body>','',$str['a']);
$str['a'] = str_replace('<div>','',$str['a']);
$str['a'] =
str_replace('</div>','',$str['a']);
$str['a'] = str_replace('<ul>','',$str['a']);
$str['a'] =
str_replace('<li>','',$str['a']);
$str['a'] = htmlspecialchars(nl2br($str['a']));
$str['a'] = preg_replace('/^({<br />})+$/','<br
/>',$str['a']);
----
Server IP: 195.221.21.36
Probable Submitter: 82.225.59.175
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/71514
Del: integrated -- https://master.php.net/note/delete/71514/integrated
Del: useless -- https://master.php.net/note/delete/71514/useless
Del: bad code -- https://master.php.net/note/delete/71514/bad+code
Del: spam -- https://master.php.net/note/delete/71514/spam
Del: non-english -- https://master.php.net/note/delete/71514/non-english
Del: in docs -- https://master.php.net/note/delete/71514/in+docs
Del: other reasons-- https://master.php.net/note/delete/71514
Reject -- https://master.php.net/note/reject/71514
Search -- https://master.php.net/manage/user-notes.php