How do I execute PHP that is stored in a MySQL database?
eval() function was covered in various other feedbacks below. I concur you need to restrict use
eval unless it is definitely required. As opposed to having PHP code in db you can have simply a class name that has actually method called, claim,
execute(). Whenever you require to run your personalized PHP code simply instantiate the class of name you simply brought from db and also run
->execute() on it. It is much cleaner remedy and also offers you wonderful area of adaptability and also boosts website protection dramatically.
You can make use of the eval command for this. I would certainly advise versus this though, due to the fact that there is a great deal of challenges utilizing this strategy. Debugging is tough (emergency room), it indicates some protection threats (negative web content in the DB obtains implemented, uh oh).
See When is eval evil in php? as an example. Google for Eval profanes, and also you'll locate a great deal of instances why you need to locate an additional remedy.
Enhancement: Another excellent write-up with some referrals to ventures is this blogpost. Describes previous vBulletin and also phpMyAdmin ventures which were brought on by inappropriate Eval use.