Elias, du sagtest, man solle trotz einer
Prüfung der Eingabedaten
NIE eine Datei includen ...
Mein folgender Code tut sowas nach sehr starker
Prüfung:
PHP-Code:
<?php
//
// Erlaubte Sektionsdateien
$sections = array();
$sections[] = 'index'; /* Startseite */
$sections[] = 'list'; /* Seite, die die News listet */
$sections[] = 'add'; /* Eigenen Link hinzufügen */
$sections[] = 'contact'; /* Kontakt */
//...
?>
<!-- Inhalt -->
<div class="primary">
<?php
if( isset($_GET['s']) && trim( $_GET['s'] ) != '' )
$actP = strtolower( $_GET['s'] );
else
$actP = 'index';
if( in_array($actP, $sections) && file_exists('sections/'.$actP.'.php') )
include_once( 'sections/' . $actP . '.php' );
else
include_once( 'sections/' . $sections[0] . '.php' );
?>
<br />
</div>
ist der Code nun schlimm? Ich weiß nicht, wie man dabei eine andere Datei includen könnte, als welche aus dem Ordner 'Sections' bzw eine, die im Array $sections festgelegt ist ...