Page 1 of 1
problem with replace
Posted: Tue Oct 04, 2005 5:30 am
by AndrewBacca
Code: Select all
$template = str_replace("<% main %>", $main, $template);
$main is data from a .php file which contains the following
but when i go to my browser and run it all, it replaces it all ok, but the above php doesn't "compile" I check the source code (in firefox) and it looks like this
<? print "blah"; ?>
anyone got any ideas as this is annoying the hell out of me!
Posted: Tue Oct 04, 2005 5:39 am
by Jenk
eval()
But do becareful when using eval!
Posted: Tue Oct 04, 2005 5:44 am
by AndrewBacca
thnx!
what do I do if the template string has none php code in it tho?
Posted: Tue Oct 04, 2005 7:14 am
by AndrewBacca
>> Resolved

Posted: Tue Oct 04, 2005 8:18 am
by BDKR
I know this is resolved, but I just wanted to reinforce the warning from Jenk. If you are running code that is stored in a database, you need to be extra careful and dilligent in your policy about exactly what coming out of a db is eval'd, and even more important, strict policies about what goes in and how it get's in there.
Isle of Wight eh? I'd like to visit that place someday.
Cheers