note 15134 deleted from function.htmlspecialchars by irc-html

From: Date: Tue, 22 Jan 2002 23:05:04 +0000
Subject: note 15134 deleted from function.htmlspecialchars by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25709@lists.php.net to get a copy of this message
[Ed Note: See strip_tags() function for similar functionality of deleting HTML tags. --irc-html@php.net] A better function to delete all html-tags is this one. It will delete all html-tags but not the text between the tags. And when there are some tags not filtered it will be filtered through the htmlspecialchars function. function delete_html($form_name) { $form_name = str_replace("[", "", "$form_name"); $form_name = str_replace("]", "", "$form_name"); $not ="\"'*\abcdefghijklmnopqrstuvwxyz1234567890áéíóúýâêîôûàèìòùçäëïöüÿ=~`@#$%^&*()_{}\n\t\r\ /;:.!?,+-"; $form_name = eregi_replace("(</)+[$not]+(>)", "", "$form_name"); $form_name = eregi_replace("(<)+[$not]+(>)", "", "$form_name"); $form_name = str_replace("<", "", $form_name); $form_name = str_replace(">", "", $form_name); $form_name = htmlspecialchars($form_name); return $form_name; } $message = delete_html($message);

« previous php.notes (#25709) next »