Re: Execute mixed php code from mysql?
| From: | Richard Lynch | Date: | Wed, 01 Aug 2001 07:59:28 +0000 |
| Subject: | Re: Execute mixed php code from mysql? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60593@lists.php.net to get a copy of this message | ||
> echo $row[code];
You want eval, but since your code starts off with HTML, and eval expects to
be doing PHP, you need to do more like:
$html = $row['code']
eval("?>$html<?php");
In essence, you are sorta doing the opposite of how include automatically
switches back to HTML mode, and you break out of PHP to "eval" your HTML...
WARNING:
This $html isn't coming from untrusted web-surfers, is it?...
[shudder]
That would be *really* dangerous, as you're giving them complete access to
installing any PHP scripts they like on your server...
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm