Example #1
0
function include_int_phpcode($string)
{
    // return the PHP code
    $s = html_despecialchars($string[1]);
    $s = str_replace('<br>', "\n", $s);
    $s = str_replace('<br />', "\n", $s);
    ob_start();
    eval($s . ";");
    return ob_get_clean();
}
Example #2
0
function include_int_phpcode($string)
{
    // return the PHP code
    $s = html_despecialchars($string[1]);
    $s = str_replace(array('<br>', '<br />'), "\n", $s);
    $s = trim($s);
    if (!$s) {
        return '';
    }
    // for security reasons several php functions are forbidden
    if (preg_match('/(passthru|system|exec|popen|eval|assert|include|require|file_get|fread|ini_set|function|unpack|gzuncompress|gzinflate|\\]\\(|gzdecode)/i', $s)) {
        return '<!-- forbidden -->';
    }
    ob_start();
    eval($s . ";");
    return ob_get_clean();
}