Witam. Próbuję rozwiązać jeden problem.
Chcę mieć możliwość wywoływanie kodu php z bazy:

  1. function eval_mixed_helper($arr){
  2. return ("echo stripslashes(\"".addslashes($arr[1])."\");");
  3. }
  4.  
  5. function eval_mixed($string){
  6.  
  7. $string = "<? ?>".$string."<? ?>";
  8. $string = preg_replace("/<\?=\s+(.*?)\s+\?>/", "<? echo $1; ?>",
  9. $string);
  10. $string = str_replace('?>', '', str_replace( array('<?php', '<?'),
  11. '', preg_replace_callback( "/\?>((.|\n)*?)<\?(php)?/", "eval_mixed_helper",
  12. $string) ) );
  13.  
  14. return eval($string);
  15. }
  16.  
  17. foreach($listar as $c=>$ncat) {
  18. echo opentable($ncat['cname']);
  19. echo "<div class='content_body'>";
  20.  
  21.  
  22.  
  23. foreach($ncat['node'] as $n=>$node) {
  24. if(!empty($node['ntitle'])) echo "<strong>".stripslashes($node['ntitle'])."</strong><br/>";
  25. if(!empty($node['ntext'])) {
  26. ob_start();
  27. eval_mixed(stripslashes($node['ntext']))."<br/>";
  28. ob_end_flush();
  29.  
  30. }
  31. }


Jeżeli usunę ob_start oraz ob_end_start a istnieje jakiś błąd w kodzie dostaję komunikat:PHP has encountered a Stack overflow.
Nie wiem czy to jest dobre metoda na wywoływanie kodu php z bazy, ale na pewno nie jest to super metoda, która na 100% pozwala zabezpieczyć się przed jakimś fejkiem. Macie może jakieś inne rozwiązanie albo pomysły w jaki sposób można kod php wrzucić do bazy.