PHP eval() code in between <?php ?> from database
- by kr1zmo
Some of you may be annoyed with this question, and claim it's unsafe blah blah.
I want to be able to put php into the database and run it. I have to do this because I store page layouts in the database and each our different for each other, however in some cases I want to use dynamic content for some of the pages.
assume $query_from_db is the string returned from the database. php should only eval() the code in between <?php and ?>
$query_from_db = '<div>
<?php
//php to run
function dosomething() {
//bleh
}
?>
</div>
';
php echo eval($query_from_db);