note 64121 added to function.strip-tags

From: Date: Fri, 07 Apr 2006 20:57:18 +0000
Subject: note 64121 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-107545@lists.php.net to get a copy of this message
A simple little function for blocking tags by replacing the '<' and '>' characters with their HTML entities. Good for simple posting systems that you don't want to have a chance of stripping non-HTML tags, or just want everything to show literally without any security issues: <?php function block_tags($string){ $replaced_string = str_ireplace('<','&lt',$string); $replaced_string = str_ireplace('>','&gt',$replaced_string); return $replaced_string; } echo block_tags('<b>HEY</b>'); //Returns &ltb&gtHEY&lt/b&gt ?> ---- Server IP: 216.194.113.175 Probable Submitter: 68.36.60.81 ---- X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.strip-tags.php Edit -- http://master.php.net/note/edit/64121 Del: integrated -- http://master.php.net/note/delete/64121/integrated Del: useless -- http://master.php.net/note/delete/64121/useless Del: bad code -- http://master.php.net/note/delete/64121/bad+code Del: spam -- http://master.php.net/note/delete/64121/spam Del: non-english -- http://master.php.net/note/delete/64121/non-english Del: in docs -- http://master.php.net/note/delete/64121/in+docs Del: other reasons-- http://master.php.net/note/delete/64121 Reject -- http://master.php.net/note/reject/64121 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107545) next »