note 80328 added to function.ob-start

From: Date: Thu, 10 Jan 2008 15:06:52 +0000
Subject: note 80328 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-134996@lists.php.net to get a copy of this message
Here's a simple way, using register_shutdown_function, to easily maintain your global output filter: File: outputfilter.inc.php <?php initOutputFilter(); function initOutputFilter() { ob_start('cbOutputFilter'); register_shutdown_function('ob_end_flush'); } function cbOutputFilter($output) { $search = array( 'user@domain.com', 'user2@domain.com', ); $replace = array( '<img src="/images/nospam001.jpg" border="0" alt="" />', '<img src="/images/nospam002.jpg" border="0" alt="" />', ); return str_replace($search, $replace, $output); } ?> Just include it in your global file, or in each file you want to filter. This one in particular replaces any occurrence of "user@domain.com" or "user2@domain.com" with an image (that contains each email respectively), preventing spam bots from picking it up. ---- Server IP: 66.207.199.35 Probable Submitter: 209.29.21.251 ---- Manual Page -- http://www.php.net/manual/en/function.ob-start.php Edit -- https://master.php.net/note/edit/80328 Del: integrated -- https://master.php.net/note/delete/80328/integrated Del: useless -- https://master.php.net/note/delete/80328/useless Del: bad code -- https://master.php.net/note/delete/80328/bad+code Del: spam -- https://master.php.net/note/delete/80328/spam Del: non-english -- https://master.php.net/note/delete/80328/non-english Del: in docs -- https://master.php.net/note/delete/80328/in+docs Del: other reasons-- https://master.php.net/note/delete/80328 Reject -- https://master.php.net/note/reject/80328 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134996) next »