.*<\\/phpcode>)/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff for ($phpexec_i = 0; $phpexec_i < $stop; $phpexec_i++) { $content = $textarr[$phpexec_i]; if (preg_match("/^(.*)<\\/phpcode>/Us", $content, $code)) { // If it's a phpcode $content = '[phpcode]' . base64_encode($code[1]) . '[/phpcode]'; } $output .= $content; } return $output; } ### unmask code after balanceTags ### function php_exec_post($text) { $textarr = preg_split("/(\\[phpcode\\].*\\[\\/phpcode\\])/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff for ($phpexec_i = 0; $phpexec_i < $stop; $phpexec_i++) { $content = $textarr[$phpexec_i]; if (preg_match("/^\\[phpcode\\](.*)\\[\\/phpcode\\]/Us", $content, $code)) { // If it's a phpcode $content = '' . base64_decode($code[1]) . ''; } $output .= $content; } return $output; } ### main routine ### function php_exec_process($phpexec_text) { $phpexec_userdata = get_userdatabylogin(the_author('login',false)); if($phpexec_userdata->user_level >= php_exec_getuserlevel()){ $phpexec_doeval = true; } $phpexec_textarr = preg_split("/(.*<\\/phpcode>)/Us", $phpexec_text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $phpexec_stop = count($phpexec_textarr);// loop stuff for ($phpexec_i = 0; $phpexec_i < $phpexec_stop; $phpexec_i++) { $phpexec_content = $phpexec_textarr[$phpexec_i]; if (preg_match("/^(.*)<\\/phpcode>/Us", $phpexec_content, $phpexec_code)) { // If it's a phpcode $phpexec_php = $phpexec_code[1]; if ($phpexec_doeval) { ob_start(); eval("?>". $phpexec_php . "

User level saved successfully.

'; } ?>

PHPExec Options

Minimum User Level
User Level:
Sets the minimum level to allow users to run PHP code in posts. If option is not set, then defaults to 9.