eval and ob_start stuff

ok here is what i am trying to do and i hope you all can help me…

I have Mandrake Linux installed on one of my home pc’s with lamp system on it. I have a portal script i created on my windows lamp pc that should basic work the same and it did but one thing…

here is the code that is giving me an issue:

ob_start(); $imp_file=implode("", file($filename)) ; $imp_file = addslashes($imp_file); eval($imp_file); $file_content = ob_get_contents(); ob_end_flush();

what i am trying to send to this code is and html file with lets say

. What I want the eval to do is to take $width and make lets say 55%. I have everything correct i think and I have tried many other examples on the net for evaluating a string but all i get is an error:
Parse error: syntax error, unexpected T_STRING in /var/www/html/Public_Html/PhpCurciut/themes/Voyix/theme.php(147) : eval()'d code on line 1

now just to let you know the theme looks simular to php nuke (i have also tried to use the way they eval there themes), but it still gave the same error

ex: $tmpl_file = "themes/$theme/content_page.html"; $thefile = implode("", file($tmpl_file)); $thefile = addslashes($thefile); $thefile = "$r_file="".$thefile."";"; eval($thefile); print $r_file;

please help Im so lost lol

eval is one of those digusting little quirks the PHP language would be better off without. It has its uses, but unless you’re a PHP specialist, don’t consider using it (even I can’t think of any situation in which it would be the ‘right’ choice). You certainly don’t want to use functions like eval, exec, etc. in a script that’s accessible from the internet.

What you probably want, is something like the following:

ob_start();
include($filename);
$file_content = ob_get_contents();
ob_end_flush();

See if that works for you.

Sponsor our Newsletter | Privacy Policy | Terms of Service