hello i try to split and replace a mysql result
i have one form to store data and one field called description
in this textarea (description) i write
-----------------
hello all this is a text <code> ?> $4 = 2+2; echo "$4"; <?</code>
------------------
okay now i want to execute the code but ooooonly from <code> to </code>
to use as folowing
$description = $row->description; // hello all this is a text
and
$description = eval($row->description); // 4
echo $description;
any good idea ?
i thin something that
$description .= preg_replace("[<code>]", " "; echo eval( ", $row->description);
$description .= preg_replace("[</code>]", " ); ", $row->description);
echo $description;
but not working
splite and replace code
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: splite and replace code
I'm having a very hard time working out what you are asking! You want a text area to allow <code> ... </code> tags, which can contain PHP code, which when submitted will actually evaluate the code and replace the code and tags with the result?
It already sounds like an enormous security hole, but if you post some more code, preferably in [ php ] tags, and use better punctuation, someone will probably help.
It already sounds like an enormous security hole, but if you post some more code, preferably in [ php ] tags, and use better punctuation, someone will probably help.