I'm not necessarily talking about allowing users themselves use PHP. I mean more like:
A user enters bbcode with an integer as the value
Say the replacement for that particular bbcode is a simple function that accepts the variable as a parameter (yes, I realize this is basically letting users execute PHP)
When the bbcode is actually posted, $input = (int) request_var('input', 0); would ensure the parameter to be passed is in fact an integer only. Other checks can be made to ensure that no strings are allowed.
When the checks are passed and the function is executed, the sql_escape() function can then be used once again to ensure the state hasn't changed from an integer.
It would require extensive testing to make sure things like
- Code: Select all
mal_func([bbcode_func]1[/bbcode_func])
couldn't be executed and that user's can't just type in functions or PHP scripts and have them executed.