PHP eval() code in between <?php ?> from database
Posted
by
kr1zmo
on Stack Overflow
See other posts from Stack Overflow
or by kr1zmo
Published on 2011-02-21T23:23:02Z
Indexed on
2011/02/21
23:25 UTC
Read the original article
Hit count: 239
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);
© Stack Overflow or respective owner