note 55480 deleted from function.eval by sean

From: Date: Thu, 04 Aug 2005 20:06:00 +0000
Subject: note 55480 deleted from function.eval by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93095@lists.php.net to get a copy of this message
Note Submitter: tomek at zdybal dot lap dot pl ---- Following script is loading any site with php-tags: <?php function eval_html($eval_str) { $eval_str = preg_replace("/\?>(.*?)(<\?php|<\?)/si", "echo \"\1\";", $eval_str); preg_match("/(<\?php|<\?)(.*?)\?>/si", $eval_str, $raw_php_matches); $raw_php_str = $raw_php_matches[0]; $raw_php_str = str_replace("<?php", "", $raw_php_str); $raw_php_str = str_replace("?>", "", $raw_php_str); ob_start(); eval("$raw_php_str;"); $exec_php_str = ob_get_contents(); ob_end_clean(); $eval_str = preg_replace("/(<\?php|<\?)(.*?)\?>/si", $exec_php_str, $eval_str, 1); return $eval_str; } ?> You can load sites like that: <?php $a = 1; if($a == 1){ ?> <br />ir?<br /> <?php } ?> and also: <?php $a = 1; if($a == 1){ echo "<br />ir?<br />"; } ?> XHTML-tags can be loaded safetly. Based on script by michael at smartgrp dot net, one line from script by arnico at c4 dot lv I hope it will be useful.

« previous php.notes (#93095) next »