All pastes #262949 Raw Edit

McPeter

public php v1 · immutable
·published 2006-12-01 01:01 UTC
rendered paste body
<?php/*	Protection des données	./private/script/protect.php	::end| 30/12/2005 - 07:13	---------------------------------------------	Script Original : http://fr2.php.net/manual/fr/function.preg-replace.php	for Click & Portal Sources - http://www.clicksources.com	T.T.P.M. - http://www.ttpm.fr*/function protectData($data){	$search = array ('@<script[^>]*?>.*?</script>@si', // Supprime le javascript			 '@<[\/\!]*?[^<>]*?>@si',          // Supprime les balises HTML			 '@([\r\n])[\s]+@',                // Supprime les espaces			 '@&(quot|#34);@i',                // Remplace les entités HTML			 '@&(amp|#38);@i',			 '@&(lt|#60);@i',			 '@&(gt|#62);@i',			 '@&(nbsp|#160);@i',		         '@&(iexcl|#161);@i',			 '@&(cent|#162);@i',			 '@&(pound|#163);@i',			 '@&(copy|#169);@i',			 '@&#(\d+);@e');                    // Evaluation comme PHP		$replace = array ('',			 '',			 '\1',			 '"',			 '&',			 '<',			 '>',			 ' ',			 chr(161),			 chr(162),			 chr(163),			 chr(169),			'chr(\1)');		return preg_replace($search, $replace, $data);}?>