note 41586 modified in function.preg-replace by aidan

From: Date: Fri, 27 Aug 2004 15:04:19 +0000
Subject: note 41586 modified in function.preg-replace by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75424@lists.php.net to get a copy of this message
A function to remove XSS exploits from text strings by replacing the dangerous HTML tags with safe equivalents. <?php function xss_remove ($text) { //Replaces <script>, <img> and <iframe> tags with safe HTML equivalents $text = preg_replace ("~(</*script.*?>|<img.*?>|</*iframe>)~ise", "htmlentities (stripslashes (\\"$1\\"))", html_entity_decode (urldecode ($text))); return $text; } ?> --was-- A function to remove XSS exploits from text strings by replacing the dangerous HTML tags with safe equivalents. function xss_remove ($text) { //Replaces <script>, <img> and <iframe> tags with safe HTML equivalents $text = preg_replace ("~(</*script.*?>|<img.*?>|</*iframe>)~ise", "htmlentities (stripslashes (\\"$1\\"))", html_entity_decode (urldecode ($text))); return $text; } # xss_remove http://php.net/manual/en/function.preg-replace.php

« previous php.notes (#75424) next »