MyBB Community Forums

Full Version: Custom variable: A potential security issue was found in the template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm not sure if it's the right section. Please let me know if it is not.

I've added some custom information from the database in global.php file.

What I have added:
$dona = $db->simple_select('donaciones', 'SUM(amount) AS amount', "amount - comision > 0");
$donaAmount = 0;
$donaTarget = 15;
$donaPercent = 0;
$donata = $db->fetch_array($dona);
$donaAmount = $donata['amount'];
$db->free_result($dona);

$donaPercent = $donaPercent != 0?round(($donaAmount*100)/$donaPercent):0;
$donaAmount = round($donaAmount,2);
if ($donaPercent > 100){
    $donaPercent = 100;
}


Then I edited the header template. I've added:
<div style="display: inline; position: relative; top: -9px;">Objetivo: ${$donaTarget} &nbsp;USD - Cantidad: ${$donaAmount} - Porcentaje: ${$donaPercent}</div>

When I try to save the template it says:
A potential security issue was found in the template.

If I delete my custom vars, the template is saved as expected.

I've found some threads about the same error, but none of them could solve my specific problem.

Thanks in advane.
${$xxx} = variable variables in PHP, which are disallowed by MyBB's template security regex checks. You should add the $ character to a string, e.g. $donaTarget = '$15';