MyBB Community Forums

Full Version: [LOW PRIORITY] How does MyBB prevent PHP from parsing in templates?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I didn't know where else to ask this question. How does MyBB prevent PHP from being parsed in the templates? I need to mimic this feature, but I'm a novice and MyBB's code confuses me.

I need to create a file with an extension of .php, but I need the content of a PHP variable to be checked and have all PHP removed from it. I could do
str_replace("<?", "&amp;lt;?", $var);
str_replace("?>","?&amp;gt;",$var);
str_replace("<%","&amp;lt;%",$var);
str_replace("%>","%&amp;gt;",$var);
, but
<script language="php">
can also work depending on the host, and there's no str_replace method that can guarantee a fix for that.

Any help?

Thanks!
lupus6x9