Example safe use of eval()
| From: | David Pratt | Date: | Thu, 01 Aug 2002 19:26:02 +0000 |
| Subject: | Example safe use of eval() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-110733@lists.php.net to get a copy of this message | ||
I am trying to get code that I have saved as a string in a database to
evaluate as code within a larger script with a loop. There are obvious
security concerns with allowing users to input code into the field if it is
not preprocessed before it is evaluated. The eval function appears to be the
ticket with PHP 4 since it will return the results as well. Has anyone got
an example of an appropriate preprocessing strategy and/or example of eval()
being used this way? Thanks to those that replied to my original post.
--
Dave Pratt