note 61287 deleted from function.strip-tags by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:02:01 +0000 |
| Subject: | note 61287 deleted from function.strip-tags by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154741@lists.php.net to get a copy of this message | ||
Note Submitter: lucahomer at hotmail dot com
----
I think the Regular expression posted <a href=function.strip-tags.php#51383>HERE</a> is
not correct
<?php
$disalowedtags = array("font");
foreach ($_GET as $varname)
foreach ($disalowedtags as $tag)
----------------------------------------------------------
if (eregi("<[^>]*".$tag."*\"?[^>]*>", $varname)) <---
----------------------------------------------------------
die("stop that");
?>
this function also replaces links like this :
<a href=font.php>test</a>
because word "font" is between tags "<" ">".
I changed reg exp with this
-----------------------------------------------------
if (eregi("(<|</)".$tag."*\"?[^>]*>", $varname))
-----------------------------------------------------
bye
Luca